function LoadTest::testLoadMissingFid

Same name and namespace in other branches
  1. 8.9.x core/modules/file/tests/src/Kernel/LoadTest.php \Drupal\Tests\file\Kernel\LoadTest::testLoadMissingFid()
  2. 10 core/modules/file/tests/src/Kernel/LoadTest.php \Drupal\Tests\file\Kernel\LoadTest::testLoadMissingFid()
  3. 11.x core/modules/file/tests/src/Kernel/LoadTest.php \Drupal\Tests\file\Kernel\LoadTest::testLoadMissingFid()

Try to load a non-existent file by fid.

File

core/modules/file/tests/src/Kernel/LoadTest.php, line 18

Class

LoadTest
Tests <a href="/api/drupal/core%21lib%21Drupal%21Core%21Entity%21EntityBase.php/function/EntityBase%3A%3Aload/9" title="Loads an entity." class="local">\Drupal\file\Entity\File::load</a>().

Namespace

Drupal\Tests\file\Kernel

Code

public function testLoadMissingFid() {
    $this->assertNull(File::load(-1), 'Try to load an invalid fid fails.');
    $this->assertFileHooksCalled([]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.