You are here

public function FileFieldTestBase::assertFileExists in Drupal 8

Asserts that a file exists physically on disk.

File

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

Class

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

Namespace

Drupal\file\Tests

Code

public function assertFileExists($file, $message = NULL) {
  $message = isset($message) ? $message : new FormattableMarkup('File %file exists on the disk.', [
    '%file' => $file
      ->getFileUri(),
  ]);
  $this
    ->assertTrue(is_file($file
    ->getFileUri()), $message);
}