function file_test_file_scan_callback

Helper function for testing file_scan_directory().

Each time the function is called the file is stored in a static variable. When the function is called with no $filepath parameter, the results are returned.

Parameters

$filepath: File path

Return value

If $filepath is NULL, an array of all previous $filepath parameters

1 call to file_test_file_scan_callback()
ScanDirectoryTest::testOptionCallback in drupal/core/modules/system/lib/Drupal/system/Tests/File/ScanDirectoryTest.php
Check that the callback function is called correctly.
2 string references to 'file_test_file_scan_callback'
file_test_file_scan_callback_reset in drupal/core/modules/file/tests/file_test/file_test.module
Reset static variables used by file_test_file_scan_callback().
ScanDirectoryTest::testOptionCallback in drupal/core/modules/system/lib/Drupal/system/Tests/File/ScanDirectoryTest.php
Check that the callback function is called correctly.

File

drupal/core/modules/file/tests/file_test/file_test.module, line 341
Helper module for the file tests.

Code

function file_test_file_scan_callback($filepath = NULL) {
  $files =& drupal_static(__FUNCTION__, array());
  if (isset($filepath)) {
    $files[] = $filepath;
  }
  else {
    return $files;
  }
}