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

@@ -2083,15 +2083,13 @@ class Tests_User extends WP_UnitTestCase {
$this->assertCount( 12, $actual['data'][0]['data'] );
// Check that the item added by the filter was retained.
$this->assertSame(
$this->assertCount(
1,
count(
wp_list_filter(
$actual['data'][0]['data'],
array(
'name' => 'Test Additional Data Name',
'value' => 'Test Additional Data Value',
)
wp_list_filter(
$actual['data'][0]['data'],
array(
'name' => 'Test Additional Data Name',
'value' => 'Test Additional Data Value',
)
)
);
@@ -2115,28 +2113,24 @@ class Tests_User extends WP_UnitTestCase {
$this->assertCount( 12, $actual['data'][0]['data'] );
// Check that the duplicate 'name' => 'User ID' was stripped.
$this->assertSame(
$this->assertCount(
1,
count(
wp_list_filter(
$actual['data'][0]['data'],
array(
'name' => 'User ID',
)
wp_list_filter(
$actual['data'][0]['data'],
array(
'name' => 'User ID',
)
)
);
// Check that the item added by the filter was retained.
$this->assertSame(
$this->assertCount(
1,
count(
wp_list_filter(
$actual['data'][0]['data'],
array(
'name' => 'Test Additional Data Name',
'value' => 'Test Additional Data Value',
)
wp_list_filter(
$actual['data'][0]['data'],
array(
'name' => 'Test Additional Data Name',
'value' => 'Test Additional Data Value',
)
)
);