function FileFieldTestBase::assertFileEntryNotExists

Same name in other branches
  1. 8.9.x core/modules/file/src/Tests/FileFieldTestBase.php \Drupal\file\Tests\FileFieldTestBase::assertFileEntryNotExists()
  2. 8.9.x core/modules/file/tests/src/Functional/FileFieldTestBase.php \Drupal\Tests\file\Functional\FileFieldTestBase::assertFileEntryNotExists()
  3. 10 core/modules/file/tests/src/Functional/FileFieldTestBase.php \Drupal\Tests\file\Functional\FileFieldTestBase::assertFileEntryNotExists()
  4. 11.x core/modules/file/tests/src/Functional/FileFieldTestBase.php \Drupal\Tests\file\Functional\FileFieldTestBase::assertFileEntryNotExists()

Asserts that a file does not exist in the database.

1 call to FileFieldTestBase::assertFileEntryNotExists()
FileFieldRevisionTest::testRevisions in core/modules/file/tests/src/Functional/FileFieldRevisionTest.php
Tests creating multiple revisions of a node and managing attached files.

File

core/modules/file/tests/src/Functional/FileFieldTestBase.php, line 232

Class

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

Namespace

Drupal\Tests\file\Functional

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.