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
17 class FilterIteratorTest extends RealIteratorTestCase
19 public function testFilterFilesystemIterators()
21 $i = new \FilesystemIterator($this->toAbsolute());
23 // it is expected that there are test.py test.php in the tmpDir
24 $i = $this->getMockForAbstractClass('Symfony\Component\Finder\Iterator\FilterIterator', array($i));
25 $i->expects($this->any())
27 ->will($this->returnCallback(function () use ($i) {
28 return (bool) preg_match('/\.php/', (string) $i->current());
33 foreach ($i as $item) {
37 $this->assertEquals(1, $c);
42 foreach ($i as $item) {
46 // This would fail in php older than 5.5.23/5.6.7 with \FilterIterator
47 // but works with Symfony\Component\Finder\Iterator\FilterIterator
48 // see https://bugs.php.net/68557
49 $this->assertEquals(1, $c);