1 file.test | FileTestHelper::getTestFile($type_name, $size = NULL) |
Retrieves a sample file of the specified type.
Parameters
string $type_name: File type.
mixed $size: File size.
Return value
File
- core/
modules/ file/ tests/ file.test, line 170 - 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);
}