Make WordPress Core


Ignore:
Timestamp:
09/04/2020 07:01:00 AM (4 years 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/post/types.php

    r48937 r48939  
    414414        );
    415415
    416         $this->assertEqualSetsWithIndex(
     416        $this->assertSameSetsWithIndex(
    417417            array(
    418418                'editor' => true,
     
    564564     */
    565565    public function test_get_post_types_by_support_excluding_features() {
    566         $this->assertEqualSets( array(), get_post_types_by_support( array( 'post-formats', 'page-attributes' ) ) );
     566        $this->assertSameSets( array(), get_post_types_by_support( array( 'post-formats', 'page-attributes' ) ) );
    567567    }
    568568
     
    571571     */
    572572    public function test_get_post_types_by_support_non_existant_feature() {
    573         $this->assertEqualSets( array(), get_post_types_by_support( 'somefeature' ) );
     573        $this->assertSameSets( array(), get_post_types_by_support( 'somefeature' ) );
    574574    }
    575575}
Note: See TracChangeset for help on using the changeset viewer.