public function MetadataBubblingUrlGeneratorTest::testUrlBubbleableMetadataBubbling in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Render/MetadataBubblingUrlGeneratorTest.php \Drupal\Tests\Core\Render\MetadataBubblingUrlGeneratorTest::testUrlBubbleableMetadataBubbling()
Tests bubbling of cacheable metadata for URLs.
@covers ::bubble
@dataProvider providerUrlBubbleableMetadataBubbling
Parameters
bool $collect_bubbleable_metadata: Whether bubbleable metadata should be collected.
int $invocations: The expected amount of invocations for the ::bubble() method.
array $options: The URL options.
File
- core/
tests/ Drupal/ Tests/ Core/ Render/ MetadataBubblingUrlGeneratorTest.php, line 53
Class
- MetadataBubblingUrlGeneratorTest
- Confirm that the MetadataBubblingUrlGenerator is functioning properly.
Namespace
Drupal\Tests\Core\RenderCode
public function testUrlBubbleableMetadataBubbling($collect_bubbleable_metadata, $invocations, array $options) {
$self = $this;
$this->renderer
->expects($this
->exactly($invocations))
->method('render')
->willReturnCallback(function ($build) use ($self) {
$self
->assertTrue(!empty($build['#cache']));
});
$url = new Url('test_1', [], $options);
$url
->setUrlGenerator($this->generator);
$url
->toString($collect_bubbleable_metadata);
}