4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Finder\Tests\Iterator;
15 * @author Alex Bogomazov
19 class FilterIteratorTest extends RealIteratorTestCase
21 public function testFilterFilesystemIterators()
23 $i = new \FilesystemIterator($this->toAbsolute());
25 // it is expected that there are test.py test.php in the tmpDir
26 $i = $this->getMockForAbstractClass('Symfony\Component\Finder\Iterator\FilterIterator', array($i));
27 $i->expects($this->any())
29 ->will($this->returnCallback(function () use ($i) {
30 return (bool) preg_match('/\.php/', (string) $i->current());
35 foreach ($i as $item) {
39 $this->assertEquals(1, $c);
44 foreach ($i as $item) {
48 // This would fail in php older than 5.5.23/5.6.7 with \FilterIterator
49 // but works with Symfony\Component\Finder\Iterator\FilterIterator
50 // see https://bugs.php.net/68557
51 $this->assertEquals(1, $c);