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/user/dateQuery.php

    r46586 r48939  
    3131        );
    3232
    33         $this->assertEqualSets( array( $u1 ), wp_list_pluck( $uq->results, 'ID' ) );
     33        $this->assertSameSets( array( $u1 ), wp_list_pluck( $uq->results, 'ID' ) );
    3434    }
    3535
     
    6868        );
    6969
    70         $this->assertEqualSets( array( $u1, $u2 ), wp_list_pluck( $uq->results, 'ID' ) );
     70        $this->assertSameSets( array( $u1, $u2 ), wp_list_pluck( $uq->results, 'ID' ) );
    7171    }
    7272}
Note: See TracChangeset for help on using the changeset viewer.