You are here

public function MinisiteTestBase::assertFileEntryNotExists in Mini site 8

Asserts that a file does not exist in the database.

2 calls to MinisiteTestBase::assertFileEntryNotExists()
MinisiteTestBase::assertArchiveFileNotExist in tests/src/Functional/MinisiteTestBase.php
Assert archive file does not exist.
MinisiteTestBase::assertMinisiteRemoved in tests/src/Functional/MinisiteTestBase.php
Assert that a Minisite archive and assets were removed.

File

tests/src/Functional/MinisiteTestBase.php, line 259

Class

MinisiteTestBase
Provides methods specifically for testing Minisite module's field handling.

Namespace

Drupal\Tests\minisite\Functional

Code

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