function FileRepositoryTest::testLoadByUri

Same name in other branches
  1. 9 core/modules/file/tests/src/Kernel/FileRepositoryTest.php \Drupal\Tests\file\Kernel\FileRepositoryTest::testLoadByUri()
  2. 11.x core/modules/file/tests/src/Kernel/FileRepositoryTest.php \Drupal\Tests\file\Kernel\FileRepositoryTest::testLoadByUri()

Tests loading a file by URI.

@covers ::loadByUri

File

core/modules/file/tests/src/Kernel/FileRepositoryTest.php, line 208

Class

FileRepositoryTest
Tests the FileRepository.

Namespace

Drupal\Tests\file\Kernel

Code

public function testLoadByUri() : void {
    $source = $this->createFile();
    $result = $this->fileRepository
        ->loadByUri($source->getFileUri());
    $this->assertSameFile($source, $result);
}

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