function FileEntityTestHelper::getFileByFilename in File Entity (fieldable files) 7.2
Same name and namespace in other branches
- 7.3 file_entity.test \FileEntityTestHelper::getFileByFilename()
Get a file from the database based on its filename.
Parameters
$filename: A file filename, usually generated by $this->randomName().
$reset: (optional) Whether to reset the internal file_load() cache.
Return value
A file object matching $filename.
3 calls to FileEntityTestHelper::getFileByFilename()
- FileEntityAltTitleTestCase::testFileEntityAltTitle in ./
file_entity.test - Create an "image" file and verify its associated alt and title text.
- FileEntityEditTestCase::testFileEntityAssociatedUser in ./
file_entity.test - Check changing file associated user fields.
- FileEntityEditTestCase::testFileEntityEdit in ./
file_entity.test - Check file edit functionality.
File
- ./
file_entity.test, line 49 - Test integration for the file_entity module.
Class
- FileEntityTestHelper
- @file Test integration for the file_entity module.
Code
function getFileByFilename($filename, $reset = FALSE) {
$files = file_load_multiple(array(), array(
'filename' => $filename,
), $reset);
// Load the first file returned from the database.
$returned_file = reset($files);
return $returned_file;
}