You are here

public function FileFieldTestBase::assertFileEntryNotExists in Drupal 8

Same name in this branch
  1. 8 core/modules/file/src/Tests/FileFieldTestBase.php \Drupal\file\Tests\FileFieldTestBase::assertFileEntryNotExists()
  2. 8 core/modules/file/tests/src/Functional/FileFieldTestBase.php \Drupal\Tests\file\Functional\FileFieldTestBase::assertFileEntryNotExists()

Asserts that a file does not exist in the database.

File

core/modules/file/src/Tests/FileFieldTestBase.php, line 298

Class

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

Namespace

Drupal\file\Tests

Code

public function assertFileEntryNotExists($file, $message) {
  $this->container
    ->get('entity_type.manager')
    ->getStorage('file')
    ->resetCache();
  $message = isset($message) ? $message : new FormattableMarkup('File %file exists in database at the correct path.', [
    '%file' => $file
      ->getFileUri(),
  ]);
  $this
    ->assertFalse(File::load($file
    ->id()), $message);
}