WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/04/2020 07:01:00 AM (17 months ago)
Author:
SergeyBiryukov
Message:

Tests: Introduce assertSameSets() and assertSameSetsWithIndex(), and use them where appropriate.

This ensures that not only the array values being compared are equal, but also that their type is the same.

These new methods replace most of the existing instances of assertEqualSets() and assertEqualSetsWithIndex().

Going forward, stricter type checking by using assertSameSets() or assertSameSetsWithIndex() should generally be preferred, to make the tests more reliable.

Follow-up to [48937].

See #38266.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/multisite/wpMSSitesListTable.php

    r47012 r48939  
    9494            $items = array_map( 'intval', $items );
    9595
    96             $this->assertEqualSets( array( 1 ) + self::$site_ids, $items );
     96            $this->assertSameSets( array( 1 ) + self::$site_ids, $items );
    9797        }
    9898
     
    120120            );
    121121
    122             $this->assertEqualSets( $expected, $items );
     122            $this->assertSameSets( $expected, $items );
    123123        }
    124124
     
    142142            );
    143143
    144             $this->assertEqualSets( $expected, $items );
     144            $this->assertSameSets( $expected, $items );
    145145        }
    146146
     
    179179            );
    180180
    181             $this->assertEqualSets( $expected, $items );
     181            $this->assertSameSets( $expected, $items );
    182182        }
    183183
     
    203203            );
    204204
    205             $this->assertEqualSets( $expected, $items );
     205            $this->assertSameSets( $expected, $items );
    206206        }
    207207
     
    229229            );
    230230
    231             $this->assertEqualSets( $expected, $items );
     231            $this->assertSameSets( $expected, $items );
    232232        }
    233233    }
Note: See TracChangeset for help on using the changeset viewer.