WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/04/2020 07:01:00 AM (17 months 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/widgets.php

    r48937 r48939  
    978978
    979979        // Theme mod with previous widgets was not removed.
    980         $this->assertEqualSets( $old_sidebars_widgets, get_theme_mod( 'sidebars_widgets' ) );
     980        $this->assertSameSets( $old_sidebars_widgets, get_theme_mod( 'sidebars_widgets' ) );
    981981
    982982        // Sidebar_widgets option was not updated.
     
    11501150            'wp_inactive_widgets' => array(),
    11511151        );
    1152         $this->assertEqualSets( $expected_sidebars, $new_next_theme_sidebars );
     1152        $this->assertSameSets( $expected_sidebars, $new_next_theme_sidebars );
    11531153    }
    11541154
Note: See TracChangeset for help on using the changeset viewer.