TYPO3  7.6
RecursiveDirectoryIteratorTest.php
Go to the documentation of this file.
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 
15 
17 {
26  public function testRewind($path, $seekable, $contains, $message = null)
27  {
28  try {
29  $i = new RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS);
30  } catch (\UnexpectedValueException $e) {
31  $this->markTestSkipped(sprintf('Unsupported stream "%s".', $path));
32  }
33 
34  $i->rewind();
35 
36  $this->assertTrue(true, $message);
37  }
38 
47  public function testSeek($path, $seekable, $contains, $message = null)
48  {
49  try {
50  $i = new RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS);
51  } catch (\UnexpectedValueException $e) {
52  $this->markTestSkipped(sprintf('Unsupported stream "%s".', $path));
53  }
54 
55  $actual = array();
56 
57  $i->seek(0);
58  $actual[] = $i->getPathname();
59 
60  $i->seek(1);
61  $actual[] = $i->getPathname();
62 
63  $this->assertEquals($contains, $actual);
64  }
65 
66  public function getPaths()
67  {
68  $data = array();
69 
70  // ftp
71  $contains = array(
72  'ftp://ftp.mozilla.org'.DIRECTORY_SEPARATOR.'README',
73  'ftp://ftp.mozilla.org'.DIRECTORY_SEPARATOR.'pub',
74  );
75  $data[] = array('ftp://ftp.mozilla.org/', false, $contains);
76 
77  return $data;
78  }
79 }