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/query/postStatus.php

    r48937 r48939  
    8383        );
    8484
    85         $this->assertEqualSets( $expected, wp_list_pluck( $q->posts, 'ID' ) );
     85        $this->assertSameSets( $expected, wp_list_pluck( $q->posts, 'ID' ) );
    8686    }
    8787
     
    113113        );
    114114
    115         $this->assertEqualSets( $expected, wp_list_pluck( $q->posts, 'ID' ) );
     115        $this->assertSameSets( $expected, wp_list_pluck( $q->posts, 'ID' ) );
    116116    }
    117117
     
    131131        );
    132132
    133         $this->assertEqualSets( $expected, wp_list_pluck( $q->posts, 'ID' ) );
     133        $this->assertSameSets( $expected, wp_list_pluck( $q->posts, 'ID' ) );
    134134    }
    135135
     
    148148        );
    149149
    150         $this->assertEqualSets( $expected, wp_list_pluck( $q->posts, 'ID' ) );
     150        $this->assertSameSets( $expected, wp_list_pluck( $q->posts, 'ID' ) );
    151151    }
    152152
     
    166166        );
    167167
    168         $this->assertEqualSets( $expected, wp_list_pluck( $q->posts, 'ID' ) );
     168        $this->assertSameSets( $expected, wp_list_pluck( $q->posts, 'ID' ) );
    169169    }
    170170
Note: See TracChangeset for help on using the changeset viewer.