}
- public static function disableInterwikis( $prefix, &$data ) {
- return false;
- }
-
/**
* Don't throw a warning if $function is deprecated and called later
*
$this->assertFalse( $r, "found extra row (after #$i)" );
}
+ /**
+ * Utility method taking an array of elements and wrapping
+ * each element in it's own array. Useful for data providers
+ * that only return a single argument.
+ *
+ * @since 1.20
+ *
+ * @param array $elements
+ *
+ * @return array
+ */
+ protected function arrayWrap( array $elements ) {
+ return array_map(
+ function( $element ) {
+ return array( $element );
+ },
+ $elements
+ );
+ }
+
/**
* Assert that two arrays are equal. By default this means that both arrays need to hold
* the same set of values. Using additional arguments, order and associated key can also
*/
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