You are here

public function DirectoryIterationTestCase::directoryIterationShouldBeIndependent in Zircon Profile 8.0

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

assure that a directory iteration works as expected

@test @dataProvider provideSwitchWithExpectations

Parameters

\Closure $dotFilesSwitch:

string[] $expectedDirectories:

File

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

Class

DirectoryIterationTestCase
Test for directory iteration.

Namespace

org\bovigo\vfs

Code

public function directoryIterationShouldBeIndependent(\Closure $dotFilesSwitch, array $expectedDirectories) {
  $dotFilesSwitch();
  $list1 = array();
  $list2 = array();
  $handle1 = opendir($this->fooURL);
  if (false !== ($listItem = readdir($handle1))) {
    $list1[] = $listItem;
  }
  $handle2 = opendir($this->fooURL);
  if (false !== ($listItem = readdir($handle2))) {
    $list2[] = $listItem;
  }
  if (false !== ($listItem = readdir($handle1))) {
    $list1[] = $listItem;
  }
  if (false !== ($listItem = readdir($handle2))) {
    $list2[] = $listItem;
  }
  closedir($handle1);
  closedir($handle2);
  $this
    ->assertEquals($list1, $list2);
  $this
    ->assertEquals(2, count($list1));
  $this
    ->assertEquals(2, count($list2));
}