diff --git a/tests/phpunit/tests/rest-api/rest-users-controller.php b/tests/phpunit/tests/rest-api/rest-users-controller.php index 5542c12d7d2da..2f4a2f4982eab 100644 --- a/tests/phpunit/tests/rest-api/rest-users-controller.php +++ b/tests/phpunit/tests/rest-api/rest-users-controller.php @@ -3300,7 +3300,7 @@ public function test_get_items_only_fetches_ids_for_head_requests( $method ) { global $wpdb; $users_table = preg_quote( $wpdb->users, '/' ); - $pattern = '/SELECT SQL_CALC_FOUND_ROWS wptests_users.ID\n\s+FROM\s+' . $users_table . '/is'; + $pattern = '/^SELECT\s+SQL_CALC_FOUND_ROWS\s+' . $users_table . '\.ID\n\s+FROM\s+' . $users_table . '/is'; // Assert that the SQL query only fetches the id column. $this->assertMatchesRegularExpression( $pattern, $query->request, 'The SQL query does not match the expected string.' );