You are here

function FileScanDirectoryTest::testOptionNoMask in Drupal 7

Check that the no-mask parameter is honored.

File

modules/simpletest/tests/file.test, line 1267
This provides SimpleTests for the core file handling functionality. These include FileValidateTest and FileSaveTest.

Class

FileScanDirectoryTest
Tests the file_scan_directory() function.

Code

function testOptionNoMask() {

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

  // Now use the nomast 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.');
}