function LoadTest::testLoadMissingFilepath
Same name in other branches
- 9 core/modules/file/tests/src/Kernel/LoadTest.php \Drupal\Tests\file\Kernel\LoadTest::testLoadMissingFilepath()
- 8.9.x core/modules/file/tests/src/Kernel/LoadTest.php \Drupal\Tests\file\Kernel\LoadTest::testLoadMissingFilepath()
- 11.x core/modules/file/tests/src/Kernel/LoadTest.php \Drupal\Tests\file\Kernel\LoadTest::testLoadMissingFilepath()
Try to load a non-existent file by URI.
File
-
core/
modules/ file/ tests/ src/ Kernel/ LoadTest.php, line 28
Class
- LoadTest
- Tests \Drupal\file\Entity\File::load().
Namespace
Drupal\Tests\file\KernelCode
public function testLoadMissingFilepath() : void {
$files = \Drupal::entityTypeManager()->getStorage('file')
->loadByProperties([
'uri' => 'foobar://misc/druplicon.png',
]);
$this->assertFalse(reset($files), "Try to load a file that doesn't exist in the database fails.");
$this->assertFileHooksCalled([]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.