You are here

public function DirectoryIterationTestCase::recursiveDirectoryIterationWithDotsEnabled in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/DirectoryIterationTestCase.php \org\bovigo\vfs\DirectoryIterationTestCase::recursiveDirectoryIterationWithDotsEnabled()

@test @group issue_50

File

vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/DirectoryIterationTestCase.php, line 233

Class

DirectoryIterationTestCase
Test for directory iteration.

Namespace

org\bovigo\vfs

Code

public function recursiveDirectoryIterationWithDotsEnabled() {
  vfsStream::enableDotfiles();
  vfsStream::setup();
  $structure = array(
    'Core' => array(
      'AbstractFactory' => array(
        'test.php' => 'some text content',
        'other.php' => 'Some more text content',
        'Invalid.csv' => 'Something else',
      ),
      'AnEmptyFolder' => array(),
      'badlocation.php' => 'some bad content',
    ),
  );
  $root = vfsStream::create($structure);
  $rootPath = vfsStream::url($root
    ->getName());
  $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($rootPath), \RecursiveIteratorIterator::CHILD_FIRST);
  $pathes = array();
  foreach ($iterator as $fullFileName => $fileSPLObject) {
    $pathes[] = $fullFileName;
  }
  $this
    ->assertEquals(array(
    'vfs://root' . DIRECTORY_SEPARATOR . '.',
    'vfs://root' . DIRECTORY_SEPARATOR . '..',
    'vfs://root' . DIRECTORY_SEPARATOR . 'Core' . DIRECTORY_SEPARATOR . '.',
    'vfs://root' . DIRECTORY_SEPARATOR . 'Core' . DIRECTORY_SEPARATOR . '..',
    'vfs://root' . DIRECTORY_SEPARATOR . 'Core' . DIRECTORY_SEPARATOR . 'AbstractFactory' . DIRECTORY_SEPARATOR . '.',
    'vfs://root' . DIRECTORY_SEPARATOR . 'Core' . DIRECTORY_SEPARATOR . 'AbstractFactory' . DIRECTORY_SEPARATOR . '..',
    'vfs://root' . DIRECTORY_SEPARATOR . 'Core' . DIRECTORY_SEPARATOR . 'AbstractFactory' . DIRECTORY_SEPARATOR . 'test.php',
    'vfs://root' . DIRECTORY_SEPARATOR . 'Core' . DIRECTORY_SEPARATOR . 'AbstractFactory' . DIRECTORY_SEPARATOR . 'other.php',
    'vfs://root' . DIRECTORY_SEPARATOR . 'Core' . DIRECTORY_SEPARATOR . 'AbstractFactory' . DIRECTORY_SEPARATOR . 'Invalid.csv',
    'vfs://root' . DIRECTORY_SEPARATOR . 'Core' . DIRECTORY_SEPARATOR . 'AbstractFactory',
    'vfs://root' . DIRECTORY_SEPARATOR . 'Core' . DIRECTORY_SEPARATOR . 'AnEmptyFolder' . DIRECTORY_SEPARATOR . '.',
    'vfs://root' . DIRECTORY_SEPARATOR . 'Core' . DIRECTORY_SEPARATOR . 'AnEmptyFolder' . DIRECTORY_SEPARATOR . '..',
    'vfs://root' . DIRECTORY_SEPARATOR . 'Core' . DIRECTORY_SEPARATOR . 'AnEmptyFolder',
    'vfs://root' . DIRECTORY_SEPARATOR . 'Core' . DIRECTORY_SEPARATOR . 'badlocation.php',
    'vfs://root' . DIRECTORY_SEPARATOR . 'Core',
  ), $pathes);
}