You are here

function ScanDirectoryTest::testOptionNoMask in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/File/ScanDirectoryTest.php \Drupal\system\Tests\File\ScanDirectoryTest::testOptionNoMask()

Check that the no-mask parameter is honored.

File

core/modules/system/src/Tests/File/ScanDirectoryTest.php, line 87
Contains \Drupal\system\Tests\File\ScanDirectoryTest.

Class

ScanDirectoryTest
Tests the file_scan_directory() function.

Namespace

Drupal\system\Tests\File

Code

function testOptionNoMask() {

  // Grab a listing of all the JavaScript files.
  $all_files = file_scan_directory($this->path, '/^javascript-/');
  $this
    ->assertEqual(2, count($all_files), 'Found two, expected javascript files.');

  // Now use the nomask parameter to filter out the .script file.
  $filtered_files = file_scan_directory($this->path, '/^javascript-/', array(
    'nomask' => '/.script$/',
  ));
  $this
    ->assertEqual(1, count($filtered_files), 'Filtered correctly.');
}