function LoadTest::testLoadInvalidStatus

Same name and namespace in other branches
  1. 9 core/modules/file/tests/src/Kernel/LoadTest.php \Drupal\Tests\file\Kernel\LoadTest::testLoadInvalidStatus()
  2. 8.9.x core/modules/file/tests/src/Kernel/LoadTest.php \Drupal\Tests\file\Kernel\LoadTest::testLoadInvalidStatus()
  3. 11.x 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 37

Class

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

Namespace

Drupal\Tests\file\Kernel

Code

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

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