Make WordPress Core


Ignore:
Timestamp:
09/29/2023 03:22:12 PM (3 years ago)
Author:
jorbin
Message:

Tests: Reduce usage of assertEquals

Replaces assertSame with assertCount in a number of tests.

Props ayeshrajans, jorbin.
See #58956.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/user.php

    r56548 r56746  
    20842084
    20852085                // Check that the item added by the filter was retained.
    2086                 $this->assertSame(
     2086                $this->assertCount(
    20872087                        1,
    2088                         count(
    2089                                 wp_list_filter(
    2090                                         $actual['data'][0]['data'],
    2091                                         array(
    2092                                                 'name'  => 'Test Additional Data Name',
    2093                                                 'value' => 'Test Additional Data Value',
    2094                                         )
     2088                        wp_list_filter(
     2089                                $actual['data'][0]['data'],
     2090                                array(
     2091                                        'name'  => 'Test Additional Data Name',
     2092                                        'value' => 'Test Additional Data Value',
    20952093                                )
    20962094                        )
     
    21162114
    21172115                // Check that the duplicate 'name' => 'User ID' was stripped.
    2118                 $this->assertSame(
     2116                $this->assertCount(
    21192117                        1,
    2120                         count(
    2121                                 wp_list_filter(
    2122                                         $actual['data'][0]['data'],
    2123                                         array(
    2124                                                 'name' => 'User ID',
    2125                                         )
     2118                        wp_list_filter(
     2119                                $actual['data'][0]['data'],
     2120                                array(
     2121                                        'name' => 'User ID',
    21262122                                )
    21272123                        )
     
    21292125
    21302126                // Check that the item added by the filter was retained.
    2131                 $this->assertSame(
     2127                $this->assertCount(
    21322128                        1,
    2133                         count(
    2134                                 wp_list_filter(
    2135                                         $actual['data'][0]['data'],
    2136                                         array(
    2137                                                 'name'  => 'Test Additional Data Name',
    2138                                                 'value' => 'Test Additional Data Value',
    2139                                         )
     2129                        wp_list_filter(
     2130                                $actual['data'][0]['data'],
     2131                                array(
     2132                                        'name'  => 'Test Additional Data Name',
     2133                                        'value' => 'Test Additional Data Value',
    21402134                                )
    21412135                        )
Note: See TracChangeset for help on using the changeset viewer.