function LocalTasksTest::assertSameLocalTaskUrl

Same name in other branches
  1. 10 core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php \Drupal\Tests\system\Functional\Menu\LocalTasksTest::assertSameLocalTaskUrl()

Asserts that the local task URL matches the expected alias.

Parameters

string $alias: The expected path alias.

1 call to LocalTasksTest::assertSameLocalTaskUrl()
LocalTasksTest::testLocalTaskBlockUrl in core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php
Tests local task block URLs for entities with path aliases.

File

core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php, line 363

Class

LocalTasksTest
Tests local tasks derived from router and added/altered via hooks.

Namespace

Drupal\Tests\system\Functional\Menu

Code

protected function assertSameLocalTaskUrl(string $alias) : void {
    // Assert that the href attribute of the 'View' link contains the expected
    // alias.
    $link = $this->assertSession()
        ->elementExists('xpath', '//a[text()="View"]');
    $this->assertStringContainsString($alias, $link->getAttribute('href'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.