/** * @dataProvider filteringProvider */ public function testItWorksCorrectly($expectedResult, callable $filter, $data) { $result = ArrayFilter::execute($data, $filter); $this->assertEquals($expectedResult, $result); $this->assertCount(count($expectedResult), $result); }
/** * Returns a new list that only contains the element which the filter is returned. * The filter is accept any callable type. * * The callable takes two argument, the first is the key and the second is the * value of the element. * * @param callable $filter * * @return \BuildR\Collection\ArrayList\ListInterface */ public function filter(callable $filter) { $result = ArrayFilter::execute($this->data, $filter); return new self($result); }