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