function FileFieldTestBase::assertFileEntryExists

Asserts that a file exists in the database.

4 calls to FileFieldTestBase::assertFileEntryExists()

File

drupal/core/modules/file/lib/Drupal/file/Tests/FileFieldTestBase.php, line 209
Definition of Drupal\file\Tests\FileFieldTestBase.

Class

FileFieldTestBase
Provides methods specifically for testing File module's field handling.

Namespace

Drupal\file\Tests

Code

function assertFileEntryExists($file, $message = NULL) {
  $this->container
    ->get('plugin.manager.entity')
    ->getStorageController('file')
    ->resetCache();
  $db_file = file_load($file->fid);
  $message = isset($message) ? $message : t('File %file exists in database at the correct path.', array(
    '%file' => $file->uri,
  ));
  $this
    ->assertEqual($db_file->uri, $file->uri, $message);
}