1 admin_bar.test private AdminBarWebTestCase::_getXpathLinkTrailByTitle(array $trail)

Shared logic for assertLinkTrailByTitle() and assertNoLinkTrailByTitle().

Parameters

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

Return value

array: Unindexed array with the following:

  • The xpath selector for the link.
  • The arguments to pass to the xpath selector.
  • The link trail represented as text.

File

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

Class

AdminBarWebTestCase
Base class for all administration bar web test cases.

Code

private function _getXpathLinkTrailByTitle(array $trail) {
  $xpath = array();
  $args = array();
  $message = '';
  foreach ($trail as $i => $link_text) {
    $xpath[] = '/li/a/span[text()=:text' . $i . ']';
    $args[':text' . $i] = $link_text;
    $message .= ($i ? ' » ' : '') . check_plain($link_text);
  }
  return array(
    '//div[@id="admin-bar"]/div/ul/li/ul' . implode('/ancestor::li/ul', $xpath),
    $args,
    $message,
  );
}