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/admin/includesTemplate.php

    r48907 r48939  
    162162        $wp_settings_errors = null;
    163163        add_settings_error( $blogdescription_error['setting'], $blogdescription_error['code'], $blogdescription_error['message'], $blogdescription_error['type'] );
    164         $this->assertEqualSets( array( $blogname_error, $blogdescription_error ), get_settings_errors() );
     164        $this->assertSameSets( array( $blogname_error, $blogdescription_error ), get_settings_errors() );
    165165
    166166        $wp_settings_errors = null;
Note: See TracChangeset for help on using the changeset viewer.