Better whitespace
This commit is contained in:
parent
431c9b5766
commit
1e0dbbf544
|
@ -901,15 +901,17 @@ class WC_Tests_CRUD_Orders extends WC_Unit_Test_Case {
|
||||||
* @since 3.3.0
|
* @since 3.3.0
|
||||||
*/
|
*/
|
||||||
public function test_payment_complete_error() {
|
public function test_payment_complete_error() {
|
||||||
add_action( 'woocommerce_payment_complete', array( $this, 'throwAnException' ) );
|
|
||||||
$object = new WC_Order();
|
$object = new WC_Order();
|
||||||
$object->save();
|
$object->save();
|
||||||
|
|
||||||
|
add_action( 'woocommerce_payment_complete', array( $this, 'throwAnException' ) );
|
||||||
|
|
||||||
$this->assertFalse( $object->payment_complete( '12345' ) );
|
$this->assertFalse( $object->payment_complete( '12345' ) );
|
||||||
$note = current( wc_get_order_notes( array(
|
$note = current( wc_get_order_notes( array(
|
||||||
'order_id' => $object->get_id(),
|
'order_id' => $object->get_id(),
|
||||||
) ) );
|
) ) );
|
||||||
|
|
||||||
$this->assertContains( 'Payment complete event failed', $note->content );
|
$this->assertContains( 'Payment complete event failed', $note->content );
|
||||||
|
|
||||||
remove_action( 'woocommerce_payment_complete', array( $this, 'throwAnException' ) );
|
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() {
|
public function test_update_status_error() {
|
||||||
$object = new WC_Order();
|
$object = new WC_Order();
|
||||||
$object->save();
|
$object->save();
|
||||||
|
|
||||||
add_filter( 'woocommerce_payment_complete_order_status', array( $this, 'throwAnException' ) );
|
add_filter( 'woocommerce_payment_complete_order_status', array( $this, 'throwAnException' ) );
|
||||||
|
|
||||||
$this->assertFalse( $object->update_status( 'on-hold' ) );
|
$this->assertFalse( $object->update_status( 'on-hold' ) );
|
||||||
$note = current( wc_get_order_notes( array(
|
$note = current( wc_get_order_notes( array(
|
||||||
'order_id' => $object->get_id(),
|
'order_id' => $object->get_id(),
|
||||||
) ) );
|
) ) );
|
||||||
|
|
||||||
$this->assertContains( 'Update status event failed', $note->content );
|
$this->assertContains( 'Update status event failed', $note->content );
|
||||||
|
|
||||||
remove_filter( 'woocommerce_payment_complete_order_status', array( $this, 'throwAnException' ) );
|
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() {
|
public function test_save_exception() {
|
||||||
$object = new WC_Order();
|
$object = new WC_Order();
|
||||||
$object->save();
|
$object->save();
|
||||||
|
|
||||||
add_action( 'woocommerce_before_order_object_save', array( $this, 'throwAnException' ) );
|
add_action( 'woocommerce_before_order_object_save', array( $this, 'throwAnException' ) );
|
||||||
|
|
||||||
$object->save();
|
$object->save();
|
||||||
$note = current( wc_get_order_notes( array(
|
$note = current( wc_get_order_notes( array(
|
||||||
'order_id' => $object->get_id(),
|
'order_id' => $object->get_id(),
|
||||||
) ) );
|
) ) );
|
||||||
|
|
||||||
$this->assertContains( 'Error saving order', $note->content );
|
$this->assertContains( 'Error saving order', $note->content );
|
||||||
|
|
||||||
remove_action( 'woocommerce_before_order_object_save', array( $this, 'throwAnException' ) );
|
remove_action( 'woocommerce_before_order_object_save', array( $this, 'throwAnException' ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue