Import: Handle uploads with sha1 starting with 0 properly
[mediawiki.git] / tests / phpunit / includes / GlobalFunctions / wfArrayPlus2dTest.php
blob88875bb0126eb1dd68868ece2af325b64a8d7436
1 <?php
2 /**
3 * @group GlobalFunctions
4 * @covers ::wfArrayPlus2d
5 */
6 class WfArrayPlus2dTest extends MediaWikiTestCase {
7 /**
8 * @dataProvider provideArrays
9 */
10 public function testWfArrayPlus2d( $baseArray, $newValues, $expected, $testName ) {
11 $this->assertEquals(
12 $expected,
13 wfArrayPlus2d( $baseArray, $newValues ),
14 $testName
18 /**
19 * Provider for testing wfArrayPlus2d
21 * @return array
23 public static function provideArrays() {
24 return array(
25 // target array, new values array, expected result
26 array(
27 array( 0 => '1dArray' ),
28 array( 1 => '1dArray' ),
29 array( 0 => '1dArray', 1 => '1dArray' ),
30 "Test simple union of two arrays with different keys",
32 array(
33 array(
34 0 => array( 0 => '2dArray' ),
36 array(
37 0 => array( 1 => '2dArray' ),
39 array(
40 0 => array( 0 => '2dArray', 1 => '2dArray' ),
42 "Test union of 2d arrays with different keys in the value array",
44 array(
45 array(
46 0 => array( 0 => '2dArray' ),
48 array(
49 0 => array( 0 => '1dArray' ),
51 array(
52 0 => array( 0 => '2dArray' ),
54 "Test union of 2d arrays with same keys in the value array",
56 array(
57 array(
58 0 => array( 0 => array( 0 => '3dArray' ) ),
60 array(
61 0 => array( 0 => array( 1 => '2dArray' ) ),
63 array(
64 0 => array( 0 => array( 0 => '3dArray' ) ),
66 "Test union of 3d array with different keys",
68 array(
69 array(
70 0 => array( 0 => array( 0 => '3dArray' ) ),
72 array(
73 0 => array( 1 => array( 0 => '2dArray' ) ),
75 array(
76 0 => array( 0 => array( 0 => '3dArray' ), 1 => array( 0 => '2dArray' ) ),
78 "Test union of 3d array with different keys in the value array",
80 array(
81 array(
82 0 => array( 0 => array( 0 => '3dArray' ) ),
84 array(
85 0 => array( 0 => array( 0 => '2dArray' ) ),
87 array(
88 0 => array( 0 => array( 0 => '3dArray' ) ),
90 "Test union of 3d array with same keys in the value array",