protected function LocalTaskEntityTest::assertLocalTaskLinkRoute in Entity Construction Kit (ECK) 8
Pass if a link with the specified label and href is found.
Parameters
string $route: The route name.
array $route_args: The route arguments.
string $label: Text between the anchor tags.
1 call to LocalTaskEntityTest::assertLocalTaskLinkRoute()
- LocalTaskEntityTest::assertLocalTasksFor in tests/
src/ Functional/ LocalTaskEntityTest.php - Go to a page and check if exist the local task links.
File
- tests/
src/ Functional/ LocalTaskEntityTest.php, line 93
Class
- LocalTaskEntityTest
- Tests the local task links in entities.
Namespace
Drupal\Tests\eck\FunctionalCode
protected function assertLocalTaskLinkRoute($route, array $route_args, $label) {
$url = Url::fromRoute($route, $route_args);
$links = $this
->xpath('//ul/li/a[contains(@href, :href) and normalize-space(text())=:label]', [
':href' => $url
->toString(),
':label' => $label,
]);
$this
->assertEquals(1, \count($links), $this
->t('Link with label %label found and its route is :route', [
':route' => $route,
'%label' => $label,
]));
}