diff --git a/core/modules/system/src/Tests/File/ScanDirectoryTest.php b/core/modules/system/src/Tests/File/ScanDirectoryTest.php index 4b067f0..ebb9bf4 100644 --- a/core/modules/system/src/Tests/File/ScanDirectoryTest.php +++ b/core/modules/system/src/Tests/File/ScanDirectoryTest.php @@ -7,6 +7,8 @@ namespace Drupal\system\Tests\File; +use Drupal\Core\Site\Settings; + /** * Tests the file_scan_directory() function. * @@ -146,4 +148,17 @@ function testOptionMinDepth() { $files = file_scan_directory($this->path, '/^javascript-/', array('min_depth' => 1)); $this->assertTrue(empty($files), 'Minimum-depth of 1 successfully excludes files from current directory.'); } + + /** + * Tests file_scan_directory() obeys 'file_scan_ignore_directories' setting. + */ + function testIgnoreDirectories() { + $files = file_scan_directory('core/modules/system/tests/fixtures/IgnoreDirectories', '/\.txt$/'); + $this->assertEqual(2, count($files), '2 text files found when not ignoring directories.'); + + $this->settingsSet('file_scan_ignore_directories', ['frontend_framework']); + $files = file_scan_directory('core/modules/system/tests/fixtures/IgnoreDirectories', '/\.txt$/'); + $this->assertEqual(1, count($files), '1 text files found when ignoring directories called "frontend_framework".'); + } + } diff --git a/core/modules/system/tests/fixtures/IgnoreDirectories/a.txt b/core/modules/system/tests/fixtures/IgnoreDirectories/a.txt new file mode 100644 index 0000000..e69de29 diff --git a/core/modules/system/tests/fixtures/IgnoreDirectories/frontend_framework/b.txt b/core/modules/system/tests/fixtures/IgnoreDirectories/frontend_framework/b.txt new file mode 100644 index 0000000..e69de29