function UrlGeneratorTest::testGenerateWithPathProcessorChangingOptions
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php \Drupal\Tests\Core\Routing\UrlGeneratorTest::testGenerateWithPathProcessorChangingOptions()
- 10 core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php \Drupal\Tests\Core\Routing\UrlGeneratorTest::testGenerateWithPathProcessorChangingOptions()
@covers \Drupal\Core\Routing\UrlGenerator::generateFromRoute
File
-
core/
tests/ Drupal/ Tests/ Core/ Routing/ UrlGeneratorTest.php, line 514
Class
- UrlGeneratorTest
- Confirm that the UrlGenerator is functioning properly.
Namespace
Drupal\Tests\Core\RoutingCode
public function testGenerateWithPathProcessorChangingOptions() : void {
$path_processor = $this->createMock(OutboundPathProcessorInterface::CLASS);
$path_processor->expects($this->atLeastOnce())
->method('processOutbound')
->willReturnCallback(function ($path, &$options = [], ?Request $request = NULL, ?BubbleableMetadata $bubbleable_metadata = NULL) {
$options['query'] = [
'zoo' => 5,
];
$options['fragment'] = 'foo';
return $path;
});
$this->processorManager
->addOutbound($path_processor);
$options = [];
$this->assertGenerateFromRoute('test_2', [
'Lassie' => 5,
], $options, '/goodbye/cruel/world?zoo=5#foo', (new BubbleableMetadata())->setCacheMaxAge(Cache::PERMANENT));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.