/** * @dataProvider simpleArrayProvider */ public function testMap(array $array) { $callable = function ($value) { return str_repeat($value, 2); }; $mappedArray = array_map($callable, $array); $ma = new MutableArray($array); $copiedMa = $ma->map($callable); $this->assertTrue($copiedMa === $ma); $this->assertTrue($mappedArray === $ma->toArray()); }
/** * @dataProvider simpleArrayProvider * * @param array $array */ public function testMap(array $array) { $callable = function ($value) { return str_repeat($value, 2); }; $arrayzy = new A($array); $resultArrayzy = $arrayzy->map($callable); $resultArray = array_map($callable, $array); $this->assertMutable($arrayzy, $resultArrayzy, $resultArray); }