diff --git a/core/tests/Drupal/Tests/Core/Render/MetadataBubblingUrlGeneratorTest.php b/core/tests/Drupal/Tests/Core/Render/MetadataBubblingUrlGeneratorTest.php index 9524b0d9..2cbc13c 100644 --- a/core/tests/Drupal/Tests/Core/Render/MetadataBubblingUrlGeneratorTest.php +++ b/core/tests/Drupal/Tests/Core/Render/MetadataBubblingUrlGeneratorTest.php @@ -5,6 +5,7 @@ use Drupal\Core\Render\MetadataBubblingUrlGenerator; use Drupal\Core\Url; use Drupal\Tests\Core\Routing\UrlGeneratorTest; +use Symfony\Component\HttpFoundation\Request; /** * Confirm that the MetadataBubblingUrlGenerator is functioning properly. @@ -33,7 +34,7 @@ protected function setUp() { ->method('hasRenderContext') ->willReturn(TRUE); - $this->generator = new MetadataBubblingUrlGenerator($this->generator, $this->renderer); + $this->generator = new MetadataBubblingUrlGenerator($this->generator, $this->renderer, $this->requestStack); } /** @@ -50,9 +51,13 @@ protected function setUp() { * * @dataProvider providerUrlBubbleableMetadataBubbling */ - public function testUrlBubbleableMetadataBubbling($collect_bubbleable_metadata, $invocations, array $options) { + public function testUrlBubbleableMetadataBubbling($collect_bubbleable_metadata, $invocations, $method, array $options) { $self = $this; + $request = Request::create('some/path'); + $request->setMethod($method); + $this->requestStack->push($request); + $this->renderer->expects($this->exactly($invocations)) ->method('render') ->willReturnCallback(function ($build) use ($self) { @@ -69,10 +74,14 @@ public function testUrlBubbleableMetadataBubbling($collect_bubbleable_metadata, */ public function providerUrlBubbleableMetadataBubbling() { return [ - // No bubbling when bubbleable metadata is collected. - [TRUE, 0, []], - // Bubbling when bubbleable metadata is not collected. - [FALSE, 1, []], + // No bubbling when bubbleable metadata is collected and safe method + [TRUE, 0, 'GET', []], + // Bubbling when bubbleable metadata is not collected and safe method + [FALSE, 1, 'GET', []], + // No bubbling when bubbleable metadata is collected and not safe method + [TRUE, 0, 'POST', []], + // No bubbling when bubbleable metadata is not collected and not safe method + [FALSE, 0, 'POST', []], ]; }