diff --git a/plugins/woocommerce/changelog/tests-test-46972 b/plugins/woocommerce/changelog/tests-test-46972 new file mode 100644 index 00000000000..3e1b5be1683 --- /dev/null +++ b/plugins/woocommerce/changelog/tests-test-46972 @@ -0,0 +1,5 @@ +Significance: patch +Type: tweak +Comment: Only adding a few unit tests to our code to cover the changes in PR 46972. + + diff --git a/plugins/woocommerce/tests/php/src/Internal/DataStores/Orders/OrdersTableQueryTests.php b/plugins/woocommerce/tests/php/src/Internal/DataStores/Orders/OrdersTableQueryTests.php index acddc1c05fb..083555da0b1 100644 --- a/plugins/woocommerce/tests/php/src/Internal/DataStores/Orders/OrdersTableQueryTests.php +++ b/plugins/woocommerce/tests/php/src/Internal/DataStores/Orders/OrdersTableQueryTests.php @@ -410,7 +410,7 @@ class OrdersTableQueryTests extends WC_Unit_Test_Case { public function test_query_s_argument() { $order1 = new \WC_Order(); $order1->set_billing_first_name( '%ir Woo' ); - $order1->set_billing_email( 'test_user@woo.test' ); + $order1->set_billing_email( 'test_user+shop@woo.test' ); $order1->save(); $order2 = new \WC_Order(); @@ -434,6 +434,22 @@ class OrdersTableQueryTests extends WC_Unit_Test_Case { $query = new OrdersTableQuery( $query_args ); $this->assertEqualsCanonicalizing( array( $order1->get_id() ), $query->orders ); + $query_args['s'] = 'test_user+shop'; + $query = new OrdersTableQuery( $query_args ); + $this->assertEqualsCanonicalizing( array( $order1->get_id() ), $query->orders ); + + $query_args['s'] = 'test_user+shop@woo.test'; + $query = new OrdersTableQuery( $query_args ); + $this->assertEqualsCanonicalizing( array( $order1->get_id() ), $query->orders ); + + $query_args['s'] = rawurlencode( 'test_user+shop@woo.test' ); + $query = new OrdersTableQuery( $query_args ); + $this->assertCount( 0, $query->orders ); + + $query_args['s'] = 'other_user'; + $query = new OrdersTableQuery( $query_args ); + $this->assertEqualsCanonicalizing( array( $order2->get_id() ), $query->orders ); + $query_args['s'] = 'woo.test'; $query = new OrdersTableQuery( $query_args ); $this->assertEqualsCanonicalizing( array( $order1->get_id(), $order2->get_id() ), $query->orders );