/** * @dataProvider simpleArrayProvider */ public function testMergeToRecursively(array $array) { $secondArray = ['one' => 1, 1 => 'one', 2 => 2]; $mergedArray = array_merge_recursive($secondArray, $array); $ma = new ImmutableArray($array); $copiedMa = $ma->mergeTo($secondArray, true); $this->assertTrue($copiedMa !== $ma); $this->assertTrue($mergedArray === $copiedMa->toArray()); }
/** * @dataProvider simpleArrayProvider * * @param array $array */ public function testMergeToRecursively(array $array) { $secondArray = ['one' => 1, 1 => 'one', 2 => 2]; $arrayzy = new A($array); $resultArrayzy = $arrayzy->mergeTo($secondArray, true); $resultArray = array_merge_recursive($secondArray, $array); $this->assertImmutable($arrayzy, $resultArrayzy, $array, $resultArray); }