public function UrlGeneratorTest::testGenerateWithPathProcessorChangingQueryParameter in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php \Drupal\Tests\Core\Routing\UrlGeneratorTest::testGenerateWithPathProcessorChangingQueryParameter()
@covers \Drupal\Core\Routing\UrlGenerator::generateFromRoute
Note: We use absolute covers to let \Drupal\Tests\Core\Render\MetadataBubblingUrlGeneratorTest work.
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 testGenerateWithPathProcessorChangingQueryParameter() {
$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,
];
return $path;
});
$this->processorManager
->addOutbound($path_processor);
$options = [];
$this
->assertGenerateFromRoute('test_2', [
'narf' => 5,
], $options, '/goodbye/cruel/world?zoo=5', (new BubbleableMetadata())
->setCacheMaxAge(Cache::PERMANENT));
}