0c9aca24b936ed3fb222be528132daad86b5c489
[yaffs-website] / vendor / symfony / finder / Tests / Iterator / RecursiveDirectoryIteratorTest.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\Finder\Tests\Iterator;
13
14 use Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator;
15
16 class RecursiveDirectoryIteratorTest extends IteratorTestCase
17 {
18     /**
19      * @group network
20      */
21     public function testRewindOnFtp()
22     {
23         try {
24             $i = new RecursiveDirectoryIterator('ftp://speedtest.tele2.net/', \RecursiveDirectoryIterator::SKIP_DOTS);
25         } catch (\UnexpectedValueException $e) {
26             $this->markTestSkipped('Unsupported stream "ftp".');
27         }
28
29         $i->rewind();
30
31         $this->assertTrue(true);
32     }
33
34     /**
35      * @group network
36      */
37     public function testSeekOnFtp()
38     {
39         try {
40             $i = new RecursiveDirectoryIterator('ftp://speedtest.tele2.net/', \RecursiveDirectoryIterator::SKIP_DOTS);
41         } catch (\UnexpectedValueException $e) {
42             $this->markTestSkipped('Unsupported stream "ftp".');
43         }
44
45         $contains = array(
46             'ftp://speedtest.tele2.net'.\DIRECTORY_SEPARATOR.'1000GB.zip',
47             'ftp://speedtest.tele2.net'.\DIRECTORY_SEPARATOR.'100GB.zip',
48         );
49         $actual = array();
50
51         $i->seek(0);
52         $actual[] = $i->getPathname();
53
54         $i->seek(1);
55         $actual[] = $i->getPathname();
56
57         $this->assertEquals($contains, $actual);
58     }
59 }