public function ScanDirectoryTest::testOptionNoMask in Drupal 9
Same name and namespace in other branches
- 8 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\FileCode
public function testOptionNoMask() {
// 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.');
}