1.20.x file.test | FileTestHelper::getTestFile($type_name, $size = NULL) |
Retrieves a sample file of the specified type.
File
- modules/
file/ tests/ file.test, line 140 - Tests for file.module.
Class
- FileTestHelper
- Provides methods specifically for testing File module's field handling.
Code
function getTestFile($type_name, $size = NULL) {
// Get a file to upload.
$file = current($this->backdropGetTestFiles($type_name, $size));
// Add a filesize property to files as would be read by file_load().
$file->filesize = filesize($file->uri);
return entity_create('file', (array) $file);
}