You are here

function file_test_file_scan_callback in SimpleTest 7

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 tests/file.test
Check that the callback function is called correctly.
2 string references to 'file_test_file_scan_callback'
FileScanDirectoryTest::testOptionCallback in tests/file.test
Check that the callback function is called correctly.
file_test_file_scan_callback_reset in tests/file.test
Reset static variables used by file_test_file_scan_callback().

File

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;
  }
}