You are here

function file_test_file_scan_callback in Drupal 7

Same name and namespace in other branches
  1. 8 core/modules/file/tests/file_test/file_test.module \file_test_file_scan_callback()
  2. 9 core/modules/file/tests/file_test/file_test.module \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()
FileScanDirectoryTest::testOptionCallback in modules/simpletest/tests/file.test
Check that the callback function is called correctly.
2 string references to 'file_test_file_scan_callback'
FileScanDirectoryTest::testOptionCallback in modules/simpletest/tests/file.test
Check that the callback function is called correctly.
file_test_file_scan_callback_reset in modules/simpletest/tests/file.test
Reset static variables used by file_test_file_scan_callback().

File

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

Code

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