function MetadataBubblingUrlGeneratorTest::setUpMockRenderer

Initializes the $renderer as a mock object.

1 call to MetadataBubblingUrlGeneratorTest::setUpMockRenderer()
MetadataBubblingUrlGeneratorTest::testUrlBubbleableMetadataBubbling in core/tests/Drupal/Tests/Core/Render/MetadataBubblingUrlGeneratorTest.php
Tests bubbling of cacheable metadata for URLs.

File

core/tests/Drupal/Tests/Core/Render/MetadataBubblingUrlGeneratorTest.php, line 66

Class

MetadataBubblingUrlGeneratorTest
Confirm that the MetadataBubblingUrlGenerator is functioning properly.

Namespace

Drupal\Tests\Core\Render

Code

protected function setUpMockRenderer() : void {
  $this->renderer = $this->createMock(RendererInterface::class);
  $this->renderer
    ->method('hasRenderContext')
    ->willReturn(TRUE);
  $reflection = new \ReflectionProperty($this->generator, 'renderer');
  $reflection->setValue($this->generator, $this->renderer);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.