mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-02 00:00:15 +00:00
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:
@@ -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',
|
||||
),
|
||||
)
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user