Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some unit tests to cover changes in PR 46972 #47098

Merged
merged 3 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions plugins/woocommerce/changelog/tests-test-46972
Original file line number Diff line number Diff line change
@@ -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.


Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ public function test_pre_query_escape_hook_return_null_limit() {
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();
Expand All @@ -434,6 +434,22 @@ public function test_query_s_argument() {
$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 );
Expand Down