From 76b49fef3cdd10f891ef37f9057034b15ede1721 Mon Sep 17 00:00:00 2001 From: brent Date: Wed, 30 Oct 2024 15:59:47 -0700 Subject: [PATCH] Fix lint. --- tests/OrderStatusEventTest.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/OrderStatusEventTest.php b/tests/OrderStatusEventTest.php index 1b189aa..26b749f 100644 --- a/tests/OrderStatusEventTest.php +++ b/tests/OrderStatusEventTest.php @@ -48,6 +48,7 @@ public function test_change_order_status() { $order_id = $events[0]['properties.$order_id']; $order = wc_get_order( $order_id ); $order->update_status( 'cancelled', '', true ); + static::fail_on_error_logged(); static::assertOrderStatusEventTriggered( [ '$source' => '$manual_review', @@ -55,7 +56,14 @@ public function test_change_order_status() { ] ); + // Let's try an unsupported status. + $gold_status_filter = fn( $statuses ) => array_merge( $statuses, [ 'wc-gold' => 'Gold' ] ); + add_filter( 'wc_order_statuses', $gold_status_filter ); + $order->update_status( 'gold', '', true ); + static::assertNotEmpty( static::$errors, 'No error logged for unsupported status' ); + // Clean up + remove_filter( 'wc_order_statuses', $gold_status_filter ); wp_delete_user( $user_id ); } @@ -64,7 +72,7 @@ public function test_change_order_status() { * * @param array $props Event properties. * - * @return void + * @return array Return the matching events. */ public static function assertOrderStatusEventTriggered( array $props = [] ) { $filters = [ 'event' => '$order_status' ];