function file_test_file_scan_callback in Zircon Profile 8
Same name and namespace in other branches
- 8.0 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
string|NULL $filepath: File path
Return value
array If $filepath is NULL, an array of all previous $filepath parameters
1 call to file_test_file_scan_callback()
- ScanDirectoryTest::testOptionCallback in core/
modules/ system/ src/ 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 core/
modules/ file/ tests/ file_test/ file_test.module - Reset static variables used by file_test_file_scan_callback().
- ScanDirectoryTest::testOptionCallback in core/
modules/ system/ src/ Tests/ File/ ScanDirectoryTest.php - Check that the callback function is called correctly.
File
- core/
modules/ file/ tests/ file_test/ file_test.module, line 325 - 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;
}
}