/** * @dataProvider simpleArrayProvider */ public function testPush(array $array) { $newElement1 = 5; $newElement2 = 10; $ma = new ImmutableArray($array); $copiedMa = $ma->push($newElement1, $newElement2); array_push($array, $newElement1, $newElement2); $this->assertTrue($copiedMa === $ma); $this->assertTrue($array === $copiedMa->toArray()); }
/** * @dataProvider simpleArrayProvider * * @param array $array */ public function testPush(array $array) { $newElement1 = 5; $newElement2 = 10; $arrayzy = new A($array); $resultArrayzy = $arrayzy->push($newElement1, $newElement2); $resultArray = $array; array_push($resultArray, $newElement1, $newElement2); $this->assertImmutable($arrayzy, $resultArrayzy, $array, $resultArray); }