Make WordPress Core


Ignore:
Timestamp:
09/04/2020 07:01:00 AM (5 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/menu/nav-menu.php

    r48937 r48939  
    154154            'main' => 1,
    155155        );
    156         $this->assertEqualSets( $expected_nav_menu_locations, $new_next_theme_nav_menu_locations );
     156        $this->assertSameSets( $expected_nav_menu_locations, $new_next_theme_nav_menu_locations );
    157157    }
    158158
     
    202202            'primary' => 1,
    203203        );
    204         $this->assertEqualSets( $expected_nav_menu_locations, $new_next_theme_nav_menu_locations );
     204        $this->assertSameSets( $expected_nav_menu_locations, $new_next_theme_nav_menu_locations );
    205205    }
    206206
     
    229229        );
    230230
    231         $this->assertEqualSets( $expected_nav_menu_locations, $new_next_theme_nav_menu_locations );
     231        $this->assertSameSets( $expected_nav_menu_locations, $new_next_theme_nav_menu_locations );
    232232    }
    233233}
Note: See TracChangeset for help on using the changeset viewer.