function 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.