Make WordPress Core


Ignore:
Timestamp:
09/04/2020 07:01:00 AM (2 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/selective-refresh-ajax.php

    r48937 r48939  
    378378        $this->assertInstanceOf( 'WP_Customize_Selective_Refresh', $component );
    379379        if ( isset( $this->expected_partial_ids ) ) {
    380             $this->assertEqualSets( $this->expected_partial_ids, array_keys( $partial_placements ) );
     380            $this->assertSameSets( $this->expected_partial_ids, array_keys( $partial_placements ) );
    381381        }
    382382        return $response;
     
    399399        $this->assertInstanceOf( 'WP_Customize_Selective_Refresh', $component );
    400400        if ( isset( $this->expected_partial_ids ) ) {
    401             $this->assertEqualSets( $this->expected_partial_ids, array_keys( $partial_placements ) );
     401            $this->assertSameSets( $this->expected_partial_ids, array_keys( $partial_placements ) );
    402402        }
    403403    }
     
    412412        $this->assertInstanceOf( 'WP_Customize_Selective_Refresh', $component );
    413413        if ( isset( $this->expected_partial_ids ) ) {
    414             $this->assertEqualSets( $this->expected_partial_ids, array_keys( $partial_placements ) );
     414            $this->assertSameSets( $this->expected_partial_ids, array_keys( $partial_placements ) );
    415415        }
    416416    }
Note: See TracChangeset for help on using the changeset viewer.