'class' =>
['kittens'
], 'data-toggle' => 'modal', 'data-lang' => 'es'
],
['id' => 'puppies', 'data-value' => 'foo', 'data-lang' => 'en'
],
[],
];
$result =
$twig->
render($name,
['iterations' =>
$iterations]);
$expected = '<div class="kittens" data-toggle="modal" data-lang="es"></div><div id="puppies" data-value="foo" data-lang="en"></div><div></div>';
$this->
assertEquals($expected,
$result);
// Test default creation of empty attribute object and using its method.
$name = '__string_template_test_2__';
$loader =
new ArrayLoader([$name => "<div{{ create_attribute().addClass('meow') }}></div>"
]);
$twig->
setLoader($loader);
$result =
$twig->
render($name);
$expected = '<div class="meow"></div>';
$this->
assertEquals($expected,
$result);
} /**
* @covers ::getLink
*/
public function testLinkWithOverriddenAttributes() { $url = Url::
fromRoute('<front>',
[],
['attributes' =>
['class' =>
['foo'
]]]);