function FileFieldTestBase::assertFileIsPermanent

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

Asserts that a file's status is set to permanent in the database.

1 call to FileFieldTestBase::assertFileIsPermanent()
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 243

Class

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

Namespace

Drupal\Tests\file\Functional

Code

public function assertFileIsPermanent(FileInterface $file, $message = NULL) {
    $message = $message ?? new FormattableMarkup('File %file is permanent.', [
        '%file' => $file->getFileUri(),
    ]);
    $this->assertTrue($file->isPermanent(), $message);
}

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