Tests: Reduce usage of assertEquals

Replaces assertSame with assertCount in a number of tests.

Props ayeshrajans, jorbin.
See #58956.


git-svn-id: https://develop.svn.wordpress.org/trunk@56746 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Aaron Jorbin
2023-09-29 15:22:12 +00:00
parent 1f914ecb2f
commit 702e2c76a6
16 changed files with 75 additions and 91 deletions

View File

@@ -151,56 +151,50 @@ class Tests_Meta extends WP_UnitTestCase {
$this->assertNotEquals( $this->author->user_login, $u[0]->user_login );
// Test EXISTS and NOT EXISTS together, no users should be found.
$this->assertSame(
$this->assertCount(
0,
count(
get_users(
array(
'meta_query' => array(
array(
'key' => 'meta_key',
'compare' => 'NOT EXISTS',
),
array(
'key' => 'delete_meta_key',
'compare' => 'EXISTS',
),
get_users(
array(
'meta_query' => array(
array(
'key' => 'meta_key',
'compare' => 'NOT EXISTS',
),
)
array(
'key' => 'delete_meta_key',
'compare' => 'EXISTS',
),
),
)
)
);
$this->assertSame(
$this->assertCount(
2,
count(
get_users(
array(
'meta_query' => array(
array(
'key' => 'non_existing_meta',
'compare' => 'NOT EXISTS',
),
get_users(
array(
'meta_query' => array(
array(
'key' => 'non_existing_meta',
'compare' => 'NOT EXISTS',
),
)
),
)
)
);
delete_metadata( 'user', $this->author->ID, 'meta_key' );
$this->assertSame(
$this->assertCount(
2,
count(
get_users(
array(
'meta_query' => array(
array(
'key' => 'meta_key',
'compare' => 'NOT EXISTS',
),
get_users(
array(
'meta_query' => array(
array(
'key' => 'meta_key',
'compare' => 'NOT EXISTS',
),
)
),
)
)
);