3 * @group GlobalFunctions
4 * @covers ::wfArrayPlus2d
6 class WfArrayPlus2dTest
extends MediaWikiTestCase
{
8 * @dataProvider provideArrays
10 public function testWfArrayPlus2d( $baseArray, $newValues, $expected, $testName ) {
13 wfArrayPlus2d( $baseArray, $newValues ),
19 * Provider for testing wfArrayPlus2d
23 public static function provideArrays() {
25 // target array, new values array, expected result
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",