You are here

public static function MinisiteTestBase::assertFileUriExists in Mini site 8

Asserts that a file exists physically on disk.

Uses PHPUnit\Framework\Assert::assertFileUriExists() to work with file entities.

Parameters

\Drupal\File\FileInterface|string $filename: Either the file entity or the file URI.

string $message: (optional) A message to display with the assertion.

2 calls to MinisiteTestBase::assertFileUriExists()
FieldValidationTest::testValidateRequired in tests/src/Functional/FieldValidationTest.php
Tests the required property on minisite field.
MinisiteTestBase::assertArchiveFileExist in tests/src/Functional/MinisiteTestBase.php
Assert archive file exists.

File

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

Class

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

Namespace

Drupal\Tests\minisite\Functional

Code

public static function assertFileUriExists($filename, $message = '') {
  $message = isset($message) ? $message : new FormattableMarkup('File %file exists on the disk.', [
    '%file' => $filename
      ->getFileUri(),
  ]);
  $filename = $filename instanceof FileInterface ? $filename
    ->getFileUri() : $filename;
  parent::assertFileExists($filename, $message);
}