IteratorTestCase.php 1003 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Tests\Component\Finder\Iterator;
  11. require_once __DIR__.'/Iterator.php';
  12. class IteratorTestCase extends \PHPUnit_Framework_TestCase
  13. {
  14. protected function assertIterator($expected, \Iterator $iterator)
  15. {
  16. $values = array_map(function (\SplFileInfo $fileinfo) { return $fileinfo->getPathname(); }, iterator_to_array($iterator));
  17. sort($values);
  18. sort($expected);
  19. $this->assertEquals($expected, array_values($values));
  20. }
  21. protected function assertOrderedIterator($expected, \Iterator $iterator)
  22. {
  23. $values = array_map(function (\SplFileInfo $fileinfo) { return $fileinfo->getPathname(); }, iterator_to_array($iterator));
  24. $this->assertEquals($expected, array_values($values));
  25. }
  26. }