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/oembed/WpEmbed.php

    r48937 r48939  
    5959
    6060    public function test_wp_maybe_load_embeds() {
    61         $this->assertEqualSets( array( 10, 9999 ), array_keys( $GLOBALS['wp_embed']->handlers ) );
    62         $this->assertEqualSets(
     61        $this->assertSameSets( array( 10, 9999 ), array_keys( $GLOBALS['wp_embed']->handlers ) );
     62        $this->assertSameSets(
    6363            array(
    6464                'youtube_embed_url',
     
    6666            array_keys( $GLOBALS['wp_embed']->handlers[10] )
    6767        );
    68         $this->assertEqualSets(
     68        $this->assertSameSets(
    6969            array(
    7070                'audio',
Note: See TracChangeset for help on using the changeset viewer.