1 admin_bar.test protected AdminBarWebTestCase::assertLinkTrailByTitle(array $trail)

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.

File

core/modules/admin_bar/tests/admin_bar.test, line 78
Tests for the Administration bar module.

Class

AdminBarWebTestCase
Base class for all administration bar 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-bar"]/div/ul/li/ul' . implode('/parent::li/ul', $xpath);
  $this->assertElementByXPath($xpath, $args, $message . ' link found.');
}