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/customize/nav-menus.php

    r48937 r48939  
    443443        );
    444444
    445         $this->assertEqualSets( $expected, $results[0] );
     445        $this->assertSameSets( $expected, $results[0] );
    446446    }
    447447
     
    10241024        $posts      = array_map( 'get_post', $drafted_post_ids );
    10251025        $post_names = wp_list_pluck( $posts, 'post_name' );
    1026         $this->assertEqualSets( $post_names, array_unique( $post_names ) );
     1026        $this->assertSameSets( $post_names, array_unique( $post_names ) );
    10271027    }
    10281028
Note: See TracChangeset for help on using the changeset viewer.