public function testCombineWith() { $firstArray = [1 => 'one', 2 => 'two', 3 => 'three']; $secondArray = ['one' => 1, 1 => 'one', 2 => 2]; $combinedArray = array_combine($firstArray, $secondArray); $ma = new ImmutableArray($firstArray); $copiedMa = $ma->combineWith($secondArray); $this->assertTrue($copiedMa !== $ma); $this->assertTrue($combinedArray === $copiedMa->toArray()); }
public function testCombineWith() { $firstArray = [1 => 'one', 2 => 'two', 3 => 'three']; $secondArray = ['one' => 1, 1 => 'one', 2 => 2]; $arrayzy = new A($firstArray); $resultArrayzy = $arrayzy->combineWith($secondArray); $resultArray = array_combine($firstArray, $secondArray); $this->assertImmutable($arrayzy, $resultArrayzy, $firstArray, $resultArray); }