/** * @dataProvider provideCases */ function testCases(array $insert, callable $filter, array $expect, array $expectPreserveKeys) { $iterator = new ArrayIterator($insert); $filtered = $iterator->filter($filter); $this->assertCount(count($expect), $filtered); $this->assertEquals($expect, $filtered->values()->toArray()); $this->assertEquals($expectPreserveKeys, $filtered->toArray()); }
function testFilter() { $iterator = new ArrayIterator([0]); $this->assertInstanceOf('Collections\\FilteringIterator', $iterator->filter(function () { })); }