RecursiveDirectoryIteratorTest.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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\Component\Finder\Tests\Iterator;
  11. use Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator;
  12. class RecursiveDirectoryIteratorTest extends IteratorTestCase
  13. {
  14. /**
  15. * @group network
  16. */
  17. public function testRewindOnFtp()
  18. {
  19. try {
  20. $i = new RecursiveDirectoryIterator('ftp://speedtest.tele2.net/', \RecursiveDirectoryIterator::SKIP_DOTS);
  21. } catch (\UnexpectedValueException $e) {
  22. $this->markTestSkipped('Unsupported stream "ftp".');
  23. }
  24. $i->rewind();
  25. $this->assertTrue(true);
  26. }
  27. /**
  28. * @group network
  29. */
  30. public function testSeekOnFtp()
  31. {
  32. try {
  33. $i = new RecursiveDirectoryIterator('ftp://speedtest.tele2.net/', \RecursiveDirectoryIterator::SKIP_DOTS);
  34. } catch (\UnexpectedValueException $e) {
  35. $this->markTestSkipped('Unsupported stream "ftp".');
  36. }
  37. $contains = [
  38. 'ftp://speedtest.tele2.net'.\DIRECTORY_SEPARATOR.'1000GB.zip',
  39. 'ftp://speedtest.tele2.net'.\DIRECTORY_SEPARATOR.'100GB.zip',
  40. ];
  41. $actual = [];
  42. $i->seek(0);
  43. $actual[] = $i->getPathname();
  44. $i->seek(1);
  45. $actual[] = $i->getPathname();
  46. $this->assertEquals($contains, $actual);
  47. }
  48. }