public function testGenerateTwice() { $this->urlGenerator->
expects($this->
any()) ->
method('generateFromRoute'
) ->
willReturn((new GeneratedUrl())->
setGeneratedUrl('/'
));
$url = Url::
fromRoute('<front>',
[],
['attributes' =>
['class' =>
['foo', 'bar'
]]]);
$url->
setUrlGenerator($this->urlGenerator
);
$link = Link::
fromTextAndUrl('text',
$url);
$link->
setLinkGenerator($this->linkGenerator
);
$output =
$link->
toString() .
$link->
toString();
$this->
assertEquals('<a href="/" class="foo bar">text</a><a href="/" class="foo bar">text</a>',
$output);
} /**
* Checks that a link with certain properties exists in a given HTML snippet.
*
* @param array $properties
* An associative array of link properties, with the following keys:
* - attributes: optional array of HTML attributes that should be present.
* - content: optional link content.
* @param \Drupal\Component\Render\MarkupInterface $html
* The HTML to check.
* @param int $count
* How many times the link should be present in the HTML. Defaults to 1.
*
* @internal
*/