function ScanDirectoryTest::testOptionNoMask

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/File/ScanDirectoryTest.php \Drupal\KernelTests\Core\File\ScanDirectoryTest::testOptionNoMask()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/File/ScanDirectoryTest.php \Drupal\KernelTests\Core\File\ScanDirectoryTest::testOptionNoMask()
  3. 10 core/tests/Drupal/KernelTests/Core/File/ScanDirectoryTest.php \Drupal\KernelTests\Core\File\ScanDirectoryTest::testOptionNoMask()

Check that the no-mask parameter is honored.

@covers ::scanDirectory

File

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

Class

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

Namespace

Drupal\KernelTests\Core\File

Code

public function testOptionNoMask() : void {
    // Grab a listing of all the JavaScript files.
    $all_files = $this->fileSystem
        ->scanDirectory($this->path, '/^javascript-/');
    $this->assertCount(2, $all_files, 'Found two, expected javascript files.');
    // Now use the nomask parameter to filter out the .script file.
    $filtered_files = $this->fileSystem
        ->scanDirectory($this->path, '/^javascript-/', [
        'nomask' => '/.script$/',
    ]);
    $this->assertCount(1, $filtered_files, 'Filtered correctly.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.