function file_test_file_scan_callback

Same name in other branches
  1. 9 core/modules/file/tests/file_test/file_test.module \file_test_file_scan_callback()
  2. 8.9.x core/modules/file/tests/file_test/file_test.module \file_test_file_scan_callback()
  3. 10 core/modules/file/tests/file_test/file_test.module \file_test_file_scan_callback()
  4. 11.x 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

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.