/** * @dataProvider simpleArrayProvider */ public function testFilter(array $array) { $callable = function ($value) { return 2 !== $value; }; $filteredArray = array_filter($array, $callable); $ma = new MutableArray($array); $copiedMa = $ma->filter($callable); $this->assertTrue($copiedMa === $ma); $this->assertTrue($filteredArray === $ma->toArray()); }
/** * @dataProvider simpleArrayProvider * * @param array $array */ public function testFilter(array $array) { $callable = function ($value) { return 2 !== $value; }; $arrayzy = new A($array); $resultArrayzy = $arrayzy->filter($callable); $resultArray = array_filter($array, $callable); $this->assertMutable($arrayzy, $resultArrayzy, $resultArray); }