Merge "Added release notes for 'ContentHandler::runLegacyHooks' removal"
[mediawiki.git] / tests / phpunit / includes / GlobalFunctions / wfArrayPlus2dTest.php
blob65b56ef4b35106b018bd055d1f18d24f9021dc7f
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 [
25 // target array, new values array, expected result
27 [ 0 => '1dArray' ],
28 [ 1 => '1dArray' ],
29 [ 0 => '1dArray', 1 => '1dArray' ],
30 "Test simple union of two arrays with different keys",
34 0 => [ 0 => '2dArray' ],
37 0 => [ 1 => '2dArray' ],
40 0 => [ 0 => '2dArray', 1 => '2dArray' ],
42 "Test union of 2d arrays with different keys in the value array",
46 0 => [ 0 => '2dArray' ],
49 0 => [ 0 => '1dArray' ],
52 0 => [ 0 => '2dArray' ],
54 "Test union of 2d arrays with same keys in the value array",
58 0 => [ 0 => [ 0 => '3dArray' ] ],
61 0 => [ 0 => [ 1 => '2dArray' ] ],
64 0 => [ 0 => [ 0 => '3dArray' ] ],
66 "Test union of 3d array with different keys",
70 0 => [ 0 => [ 0 => '3dArray' ] ],
73 0 => [ 1 => [ 0 => '2dArray' ] ],
76 0 => [ 0 => [ 0 => '3dArray' ], 1 => [ 0 => '2dArray' ] ],
78 "Test union of 3d array with different keys in the value array",
82 0 => [ 0 => [ 0 => '3dArray' ] ],
85 0 => [ 0 => [ 0 => '2dArray' ] ],
88 0 => [ 0 => [ 0 => '3dArray' ] ],
90 "Test union of 3d array with same keys in the value array",