You are here

public function DirectoryIterationTestCase::directoryIterationWithOpenDir_Bug_2 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::directoryIterationWithOpenDir_Bug_2()

assure that a directory iteration works as expected

@test @dataProvider provideSwitchWithExpectations @group regression @group bug_2

Parameters

\Closure $dotFilesSwitch:

string[] $expectedDirectories:

File

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

Class

DirectoryIterationTestCase
Test for directory iteration.

Namespace

org\bovigo\vfs

Code

public function directoryIterationWithOpenDir_Bug_2(\Closure $dotFilesSwitch, array $expectedDirectories) {
  $dotFilesSwitch();
  $handle = opendir($this->fooURL);
  $i = 0;
  while (false !== ($entry = readdir($handle))) {
    $i++;
    $this
      ->assertTrue(in_array($entry, $expectedDirectories));
  }
  $this
    ->assertDirectoryCount(count($expectedDirectories), $i);
  rewinddir($handle);
  $i = 0;
  while (false !== ($entry = readdir($handle))) {
    $i++;
    $this
      ->assertTrue(in_array($entry, $expectedDirectories));
  }
  $this
    ->assertDirectoryCount(count($expectedDirectories), $i);
  closedir($handle);
}