WordPress.org

Make WordPress Core

Changeset 30687


Ignore:
Timestamp:
12/01/2014 05:01:29 AM (7 years ago)
Author:
pento
Message:

Unit Tests: The assertEqualSets() helper was returning true for some sets that were not equal. assertEqualSets() now behaves correctly, and the new assertEqualSetsWithIndex() helper also checks that the array indexes are the same.

Fixes #30522.

Location:
trunk/tests/phpunit
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/testcase.php

    r30658 r30687  
    263263
    264264    function assertEqualSets( $expected, $actual ) {
    265         $this->assertEquals( array(), array_diff( $expected, $actual ) );
    266         $this->assertEquals( array(), array_diff( $actual, $expected ) );
     265        sort( $expected );
     266        sort( $actual );
     267        $this->assertEquals( $expected, $actual );
     268    }
     269
     270    function assertEqualSetsWithIndex( $expected, $actual ) {
     271        ksort( $expected );
     272        ksort( $actual );
     273        $this->assertEquals( $expected, $actual );
    267274    }
    268275
Note: See TracChangeset for help on using the changeset viewer.