function ScanDirectoryTest::testOptionRecurse

Check that the recurse option decends into subdirectories.

File

drupal/core/modules/system/lib/Drupal/system/Tests/File/ScanDirectoryTest.php, line 127
Definition of Drupal\system\Tests\File\ScanDirectoryTest.

Class

ScanDirectoryTest
Tests the file_scan_directory() function.

Namespace

Drupal\system\Tests\File

Code

function testOptionRecurse() {
  $files = file_scan_directory(drupal_get_path('module', 'simpletest'), '/^javascript-/', array(
    'recurse' => FALSE,
  ));
  $this
    ->assertTrue(empty($files), "Without recursion couldn't find javascript files.");
  $files = file_scan_directory(drupal_get_path('module', 'simpletest'), '/^javascript-/', array(
    'recurse' => TRUE,
  ));
  $this
    ->assertEqual(2, count($files), 'With recursion we found the expected javascript files.');
}