public function FileUrlGeneratorTest::testGenerateURI in Drupal 9
Same name and namespace in other branches
- 10 core/tests/Drupal/KernelTests/Core/File/FileUrlGeneratorTest.php \Drupal\KernelTests\Core\File\FileUrlGeneratorTest::testGenerateURI()
@covers ::generate
@dataProvider providerGenerateURI
File
- core/
tests/ Drupal/ KernelTests/ Core/ File/ FileUrlGeneratorTest.php, line 180
Class
- FileUrlGeneratorTest
- @coversDefaultClass \Drupal\Core\File\FileUrlGenerator
Namespace
Drupal\KernelTests\Core\FileCode
public function testGenerateURI($filepath, $expected) {
// Disable file_test.module's hook_file_url_alter() implementation.
\Drupal::state()
->set('file_test.hook_file_url_alter', NULL);
// Create a mock Request for transformRelative().
$request = Request::create($GLOBALS['base_url']);
$this->container
->get('request_stack')
->push($request);
\Drupal::setContainer($this->container);
// No schema file.
$url = $this->fileUrlGenerator
->generate($filepath);
$this
->assertEquals($expected, $url
->getUri());
}