WordPress.org

Make WordPress Core

Changeset 1127 in tests


Ignore:
Timestamp:
11/13/2012 05:58:07 PM (6 years ago)
Author:
nbachiyski
Message:

Introduce assertEqualSets()

Often we need to compare arrays without caring about the order in the
elements there.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/testcase.php

    r1105 r1127  
    7878    function assertDiscardWhitespace( $expected, $actual ) {
    7979        $this->assertEquals( preg_replace( '/\s*/', '', $expected ), preg_replace( '/\s*/', '', $actual ) );
     80    }
     81
     82    function assertEqualSets( $expected, $actual ) {
     83        $this->assertEquals( array(), array_diff( $expected, $actual ) );
     84        $this->assertEquals( array(), array_diff( $actual, $expected ) );
    8085    }
    8186
Note: See TracChangeset for help on using the changeset viewer.