12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- declare(strict_types=1);
- namespace Fgm\Drupal\Composer;
- use PHPUnit\Framework\TestCase;
- final class MergeParamsCommandTest extends TestCase {
-
- public function testMergeDeepArray() {
-
- $dist = [
- 'keyedArray1' => [
- 'key1' => 'dist1',
- 'key2' => 'dist2',
- 'key3' => 'dist3',
- ],
- 'indexedArray1' => [
- 'dist1',
- 'dist2',
- 'dist3',
- ],
- ];
-
- $local = [
- 'keyedArray1' => [
- 'key1' => 'local1',
- 'key3' => NULL,
- 'key4' => 'local4',
- ],
- 'keyedArray2' => [
- 'key1' => 'local1',
- ],
- 'indexedArray1' => [
- 'local1',
- 'local2',
- ],
- ];
-
- $merged = MergeParamsCommand::mergeDeepArray([$dist, $local]);
- $expected = [
- 'keyedArray1' => [
-
- 'key1' => 'local1',
-
- 'key2' => 'dist2',
-
-
- 'key4' => 'local4',
- ],
-
- 'keyedArray2' => [
- 'key1' => 'local1',
- ],
-
- 'indexedArray1' => [
- 'local1',
- 'local2',
- ],
- ];
- $this->assertEquals($expected, $merged);
- }
- }
|