function FileFieldTestBase::assertFileEntryExists

Asserts that a file exists in the database.

4 calls to FileFieldTestBase::assertFileEntryExists()
FileFieldRevisionTest::testRevisions in drupal/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php
Tests creating multiple revisions of a node and managing attached files.
FileFieldValidateTest::testFileExtension in drupal/core/modules/file/lib/Drupal/file/Tests/FileFieldValidateTest.php
Tests file extension checking.
FileFieldValidateTest::testFileMaxSize in drupal/core/modules/file/lib/Drupal/file/Tests/FileFieldValidateTest.php
Tests the max file size validator.
FileFieldValidateTest::testRequired in drupal/core/modules/file/lib/Drupal/file/Tests/FileFieldValidateTest.php
Tests the required property on file fields.

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