function TwigExtensionTest::testLinkWithOverriddenAttributes
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php \Drupal\Tests\Core\Template\TwigExtensionTest::testLinkWithOverriddenAttributes()
- 8.9.x core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php \Drupal\Tests\Core\Template\TwigExtensionTest::testLinkWithOverriddenAttributes()
- 11.x core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php \Drupal\Tests\Core\Template\TwigExtensionTest::testLinkWithOverriddenAttributes()
@covers ::getLink
File
-
core/
tests/ Drupal/ Tests/ Core/ Template/ TwigExtensionTest.php, line 428
Class
- TwigExtensionTest
- Tests the twig extension.
Namespace
Drupal\Tests\Core\TemplateCode
public function testLinkWithOverriddenAttributes() : void {
$url = Url::fromRoute('<front>', [], [
'attributes' => [
'class' => [
'foo',
],
],
]);
$build = $this->systemUnderTest
->getLink('test', $url, [
'class' => [
'bar',
],
]);
$this->assertEquals([
'foo',
'bar',
], $build['#url']->getOption('attributes')['class']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.