function TwigExtensionTest::testRenderVarWithGeneratedLink
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php \Drupal\Tests\Core\Template\TwigExtensionTest::testRenderVarWithGeneratedLink()
- 8.9.x core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php \Drupal\Tests\Core\Template\TwigExtensionTest::testRenderVarWithGeneratedLink()
- 11.x core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php \Drupal\Tests\Core\Template\TwigExtensionTest::testRenderVarWithGeneratedLink()
@covers ::renderVar @covers ::bubbleArgMetadata
File
-
core/
tests/ Drupal/ Tests/ Core/ Template/ TwigExtensionTest.php, line 348
Class
- TwigExtensionTest
- Tests the twig extension.
Namespace
Drupal\Tests\Core\TemplateCode
public function testRenderVarWithGeneratedLink() : void {
$link = new GeneratedLink();
$link->setGeneratedLink('<a href="http://example.com"></a>');
$link->addCacheTags([
'foo',
]);
$link->addAttachments([
'library' => [
'system/base',
],
]);
$this->renderer
->expects($this->atLeastOnce())
->method('render')
->with([
"#cache" => [
"contexts" => [],
"tags" => [
"foo",
],
"max-age" => -1,
],
"#attached" => [
'library' => [
'system/base',
],
],
]);
$result = $this->systemUnderTest
->renderVar($link);
$this->assertEquals('<a href="http://example.com"></a>', $result);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.