1 file.test FileTestHelper::assertFileEntryExists($file, $message = NULL)

Asserts that a file exists in the database.

Parameters

File $file: File entity.

string $message: Message to display.

File

core/modules/file/tests/file.test, line 380
Tests for file.module.

Class

FileTestHelper
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);
}