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