You are here

public function FileFieldTestBase::assertFileIsPermanent in Drupal 8

Same name in this branch
  1. 8 core/modules/file/src/Tests/FileFieldTestBase.php \Drupal\file\Tests\FileFieldTestBase::assertFileIsPermanent()
  2. 8 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.

File

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

Class

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

Namespace

Drupal\file\Tests

Code

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