Change-Id: I8fa45237e028a814e0895ac0f2b3723394b50d6b
*/
protected function assertArrayEquals( array $expected, array $actual, $ordered = false, $named = false ) {
if ( !$ordered ) {
- asort( $expected );
- asort( $actual );
+ $this->objectAssociativeSort( $expected );
+ $this->objectAssociativeSort( $actual );
}
if ( !$named ) {
);
}
+ /**
+ * Does an associative sort that works for objects.
+ *
+ * @since 1.20
+ *
+ * @param array $array
+ */
+ protected function objectAssociativeSort( array &$array ) {
+ uasort(
+ $array,
+ function( $a, $b ) {
+ return serialize( $a ) > serialize( $b ) ? 1 : -1;
+ }
+ );
+ }
+
/**
* Utility function for eliminating all string keys from an array.
* Useful to turn a database result row as returned by fetchRow() into