You are here

public function LoadTest::testLoadInvalidStatus in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/file/tests/src/Kernel/LoadTest.php \Drupal\Tests\file\Kernel\LoadTest::testLoadInvalidStatus()

Try to load a non-existent file by status.

File

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

Class

LoadTest
Tests \Drupal\file\Entity\File::load().

Namespace

Drupal\Tests\file\Kernel

Code

public function testLoadInvalidStatus() {
  $files = \Drupal::entityTypeManager()
    ->getStorage('file')
    ->loadByProperties([
    'status' => -99,
  ]);
  $this
    ->assertFalse(reset($files), 'Trying to load a file with an invalid status fails.');
  $this
    ->assertFileHooksCalled([]);
}