Skip to content

Commit 8080bcf

Browse files
authored
wip: cover unset query context (#1723)
1 parent 0a1c399 commit 8080bcf

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

tests/WP_Ultimo/Multiple_Accounts_Compat_Test.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,26 @@ public function test_fix_user_query_tolerates_null_func_call(): void {
3737
}
3838
}
3939

40+
/**
41+
* Test user query filter tolerates an unset wpdb function call context.
42+
*/
43+
public function test_fix_user_query_tolerates_unset_func_call(): void {
44+
45+
global $wpdb;
46+
47+
$func_call = $wpdb->func_call ?? null;
48+
49+
unset($wpdb->func_call);
50+
51+
$query = 'SELECT * FROM wp_users';
52+
53+
try {
54+
$this->assertSame($query, \WP_Ultimo\Compat\Multiple_Accounts_Compat::get_instance()->fix_user_query($query));
55+
} finally {
56+
$wpdb->func_call = $func_call;
57+
}
58+
}
59+
4060
/**
4161
* Test unrelated user columns tolerate null output from earlier filters.
4262
*/

0 commit comments

Comments
 (0)