Make WordPress Core


Ignore:
Timestamp:
06/10/2021 07:18:15 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Tests: Use assertSameSets() in some newly introduced tests.

This ensures that not only the array values being compared are equal, but also that their type is the same.

Going forward, stricter type checking by using assertSameSets() or assertSameSetsWithIndex() should generally be preferred, to make the tests more reliable.

Follow-up to [48939], [49925], [50157], [50959], [50960], [50995], [51079].

See #52625.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-themes-controller.php

    r50491 r51137  
    220220            'version',
    221221        );
    222         $this->assertEqualSets( $fields, array_keys( $data[0] ) );
     222        $this->assertSameSets( $fields, array_keys( $data[0] ) );
    223223
    224224        $this->assertContains( 'twentytwenty', wp_list_pluck( $data, 'stylesheet' ) );
     
    12371237        $fields_links = array( 'collection', 'self' );
    12381238
    1239         $this->assertEqualSets( $fields, array_keys( $data ) );
    1240         $this->assertEqualSets( $fields_links, array_keys( $links ) );
     1239        $this->assertSameSets( $fields, array_keys( $data ) );
     1240        $this->assertSameSets( $fields_links, array_keys( $links ) );
    12411241    }
    12421242
Note: See TracChangeset for help on using the changeset viewer.