From 1e0dbbf544ceb5adf3ba0dacc0d7f533328fc5b8 Mon Sep 17 00:00:00 2001 From: claudiulodro Date: Thu, 4 Jan 2018 10:31:28 -0800 Subject: [PATCH] Better whitespace --- .../order/class-wc-tests-crud-orders.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/unit-tests/order/class-wc-tests-crud-orders.php b/tests/unit-tests/order/class-wc-tests-crud-orders.php index 7b5b1b57eba..ad527923807 100644 --- a/tests/unit-tests/order/class-wc-tests-crud-orders.php +++ b/tests/unit-tests/order/class-wc-tests-crud-orders.php @@ -901,15 +901,17 @@ class WC_Tests_CRUD_Orders extends WC_Unit_Test_Case { * @since 3.3.0 */ public function test_payment_complete_error() { - add_action( 'woocommerce_payment_complete', array( $this, 'throwAnException' ) ); $object = new WC_Order(); $object->save(); + + add_action( 'woocommerce_payment_complete', array( $this, 'throwAnException' ) ); + $this->assertFalse( $object->payment_complete( '12345' ) ); $note = current( wc_get_order_notes( array( 'order_id' => $object->get_id(), ) ) ); - $this->assertContains( 'Payment complete event failed', $note->content ); + remove_action( 'woocommerce_payment_complete', array( $this, 'throwAnException' ) ); } @@ -952,13 +954,15 @@ class WC_Tests_CRUD_Orders extends WC_Unit_Test_Case { public function test_update_status_error() { $object = new WC_Order(); $object->save(); + add_filter( 'woocommerce_payment_complete_order_status', array( $this, 'throwAnException' ) ); + $this->assertFalse( $object->update_status( 'on-hold' ) ); $note = current( wc_get_order_notes( array( 'order_id' => $object->get_id(), ) ) ); - $this->assertContains( 'Update status event failed', $note->content ); + remove_filter( 'woocommerce_payment_complete_order_status', array( $this, 'throwAnException' ) ); } @@ -1881,13 +1885,15 @@ class WC_Tests_CRUD_Orders extends WC_Unit_Test_Case { public function test_save_exception() { $object = new WC_Order(); $object->save(); + add_action( 'woocommerce_before_order_object_save', array( $this, 'throwAnException' ) ); + $object->save(); $note = current( wc_get_order_notes( array( 'order_id' => $object->get_id(), ) ) ); - $this->assertContains( 'Error saving order', $note->content ); + remove_action( 'woocommerce_before_order_object_save', array( $this, 'throwAnException' ) ); } }