function FileFieldTestCase::assertFileEntryExists in Drupal 7
Asserts that a file exists in the database.
4 calls to FileFieldTestCase::assertFileEntryExists()
- FileFieldRevisionTestCase::testRevisions in modules/
file/ tests/ file.test - Tests creating multiple revisions of a node and managing attached files.
- FileFieldValidateTestCase::testFileExtension in modules/
file/ tests/ file.test - Tests file extension checking.
- FileFieldValidateTestCase::testFileMaxSize in modules/
file/ tests/ file.test - Tests the max file size validator.
- FileFieldValidateTestCase::testRequired in modules/
file/ tests/ file.test - Tests the required property on file fields.
File
- modules/
file/ tests/ file.test, line 190 - Tests for file.module.
Class
- FileFieldTestCase
- Provides methods specifically for testing File module's field handling.
Code
function assertFileEntryExists($file, $message = NULL) {
entity_get_controller('file')
->resetCache();
$db_file = file_load($file->fid);
$message = isset($message) ? $message : format_string('File %file exists in database at the correct path.', array(
'%file' => $file->uri,
));
$this
->assertEqual($db_file->uri, $file->uri, $message);
}