public function MinisiteTestBase::assertFileEntryExists in Mini site 8
Asserts that a file exists in the database.
2 calls to MinisiteTestBase::assertFileEntryExists()
- 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 249
Class
- MinisiteTestBase
- Provides methods specifically for testing Minisite module's field handling.
Namespace
Drupal\Tests\minisite\FunctionalCode
public function assertFileEntryExists($file, $message = NULL) {
$this->container
->get('entity_type.manager')
->getStorage('file')
->resetCache();
$db_file = File::load($file
->id());
$message = isset($message) ? $message : new FormattableMarkup('File %file exists in database at the correct path.', [
'%file' => $file
->getFileUri(),
]);
$this
->assertEqual($db_file
->getFileUri(), $file
->getFileUri(), $message);
}