You are here

protected function AdminMenuTestBase::assertNoLinkTrailByTitle in Administration menu 8.3

Asserts that no link appears in the menu for a specified trail.

Parameters

array $trail: A list of menu link titles to assert in the menu.

3 calls to AdminMenuTestBase::assertNoLinkTrailByTitle()
AdminMenuLinkTypesTest::testLinkTypes in lib/Drupal/admin_menu/Tests/AdminMenuLinkTypesTest.php
Tests appearance of different router item link types.
AdminMenuPermissionsTest::testCategories in lib/Drupal/admin_menu/Tests/AdminMenuPermissionsTest.php
Tests handling of links pointing to category/overview pages.
AdminMenuPermissionsTest::testPermissionChanges in lib/Drupal/admin_menu/Tests/AdminMenuPermissionsTest.php
Tests that user role and permission changes are properly taken up.

File

lib/Drupal/admin_menu/Tests/AdminMenuTestBase.php, line 97

Class

AdminMenuTestBase
Base class for all administration menu web test cases.

Namespace

Drupal\admin_menu\Tests

Code

protected function assertNoLinkTrailByTitle(array $trail) {
  $xpath = [];
  $args = [];
  $message = '';
  foreach ($trail as $i => $title) {
    $xpath[] = '/li/a[text()=:title' . $i . ']';
    $args[':title' . $i] = $title;
    $message .= ($i ? ' » ' : '') . check_plain($title);
  }
  $xpath = '//div[@id="admin-menu"]/div/ul' . implode('/parent::li/ul', $xpath);
  $this
    ->assertNoElementByXPath($xpath, $args, $message . ' link not found.');
}