You are here

function ScanDirectoryTest::testOptionRecurse 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::testOptionRecurse()

Check that the recurse option descends into subdirectories.

File

core/modules/system/src/Tests/File/ScanDirectoryTest.php, line 129
Contains \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($this->path . '/..', '/^javascript-/', array(
    'recurse' => FALSE,
  ));
  $this
    ->assertTrue(empty($files), "Without recursion couldn't find javascript files.");
  $files = file_scan_directory($this->path . '/..', '/^javascript-/', array(
    'recurse' => TRUE,
  ));
  $this
    ->assertEqual(2, count($files), 'With recursion we found the expected javascript files.');
}