You are here

protected function AdminMenuWebTestCase::assertLinkTrailByTitle in Administration menu 7.3

Same name and namespace in other branches
  1. 6.3 tests/admin_menu.test \AdminMenuWebTestCase::assertLinkTrailByTitle()

Asserts that links appear in the menu in a specified trail.

Parameters

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

4 calls to AdminMenuWebTestCase::assertLinkTrailByTitle()
AdminMenuDynamicLinksTestCase::testNodeAdd in tests/admin_menu.test
Tests Add content links.
AdminMenuLinkTypesTestCase::testLinkTypes in tests/admin_menu.test
Tests appearance of different router item link types.
AdminMenuPermissionsTestCase::testCategories in tests/admin_menu.test
Tests handling of links pointing to category/overview pages.
AdminMenuPermissionsTestCase::testPermissionChanges in tests/admin_menu.test
Tests that user role and permission changes are properly taken up.

File

tests/admin_menu.test, line 83
Tests for the Administration menu module.

Class

AdminMenuWebTestCase
Base class for all administration menu web test cases.

Code

protected function assertLinkTrailByTitle(array $trail) {
  $xpath = array();
  $args = array();
  $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
    ->assertElementByXPath($xpath, $args, $message . ' link found.');
}