You are here

public function ScanDirectoryTest::testOptionMinDepth in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/File/ScanDirectoryTest.php \Drupal\KernelTests\Core\File\ScanDirectoryTest::testOptionMinDepth()
  2. 10 core/tests/Drupal/KernelTests/Core/File/ScanDirectoryTest.php \Drupal\KernelTests\Core\File\ScanDirectoryTest::testOptionMinDepth()

Check that the min_depth options lets us ignore files in the starting directory.

@covers ::scanDirectory

File

core/tests/Drupal/KernelTests/Core/File/ScanDirectoryTest.php, line 160

Class

ScanDirectoryTest
Tests \Drupal\Core\File\FileSystem::scanDirectory.

Namespace

Drupal\KernelTests\Core\File

Code

public function testOptionMinDepth() {
  $files = $this->fileSystem
    ->scanDirectory($this->path, '/^javascript-/', [
    'min_depth' => 0,
  ]);
  $this
    ->assertCount(2, $files, 'No minimum-depth gets files in current directory.');
  $files = $this->fileSystem
    ->scanDirectory($this->path, '/^javascript-/', [
    'min_depth' => 1,
  ]);
  $this
    ->assertTrue(empty($files), 'Minimum-depth of 1 successfully excludes files from current directory.');
}