function UrlGeneratorTest::testUrlGenerationWithHttpsRequirement
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php \Drupal\Tests\Core\Routing\UrlGeneratorTest::testUrlGenerationWithHttpsRequirement()
- 8.9.x core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php \Drupal\Tests\Core\Routing\UrlGeneratorTest::testUrlGenerationWithHttpsRequirement()
- 11.x core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php \Drupal\Tests\Core\Routing\UrlGeneratorTest::testUrlGenerationWithHttpsRequirement()
Tests the 'scheme' route requirement during URL generation.
File
-
core/
tests/ Drupal/ Tests/ Core/ Routing/ UrlGeneratorTest.php, line 486
Class
- UrlGeneratorTest
- Confirm that the UrlGenerator is functioning properly.
Namespace
Drupal\Tests\Core\RoutingCode
public function testUrlGenerationWithHttpsRequirement() : void {
$url = $this->generator
->generate('test_4', [], TRUE);
$this->assertEquals('https://localhost/test/four', $url);
// No cacheability to test; UrlGenerator::generate() doesn't support
// collecting cacheability metadata.
$this->routeProcessorManager
->expects($this->exactly(2))
->method('processOutbound')
->with($this->anything());
$options = [
'absolute' => TRUE,
'https' => TRUE,
];
$this->assertGenerateFromRoute('test_1', [], $options, 'https://localhost/hello/world', (new BubbleableMetadata())->setCacheMaxAge(Cache::PERMANENT)
->setCacheContexts([
'url.site',
]));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.