You are here

function AdminMenuLinkTypesTestCase::testLinkTypes in Administration menu 6.3

Same name and namespace in other branches
  1. 7.3 tests/admin_menu.test \AdminMenuLinkTypesTestCase::testLinkTypes()

Tests appearance of different router item link types.

File

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

Class

AdminMenuLinkTypesTestCase
Tests appearance of different types of links.

Code

function testLinkTypes() {

  // Verify that MENU_NORMAL_ITEMs appear.
  $this
    ->assertLinkTrailByTitle(array(
    t('Site configuration'),
    t('Site information'),
  ));

  // Verify that MENU_LOCAL_TASKs appear.
  $this
    ->assertLinkTrailByTitle(array(
    t('User management'),
    t('Permissions'),
  ));
  $this
    ->assertLinkTrailByTitle(array(
    t('Site building'),
    t('Themes'),
    t('Configure'),
  ));
  $this
    ->assertLinkTrailByTitle(array(
    t('Site building'),
    t('Modules'),
    t('Uninstall'),
  ));

  // Verify that MENU_LOCAL_ACTIONs appear.
  $this
    ->assertLinkTrailByTitle(array(
    t('User management'),
    t('Users'),
    t('Add user'),
  ));

  // Verify that MENU_DEFAULT_LOCAL_TASKs do NOT appear.
  $this
    ->assertNoLinkTrailByTitle(array(
    t('Site building'),
    t('Modules'),
    t('List'),
  ));
  $this
    ->assertNoLinkTrailByTitle(array(
    t('User management'),
    t('Users'),
    t('List'),
  ));
  $this
    ->assertNoLinkTrailByTitle(array(
    t('User management'),
    t('Users'),
    t('Permissions'),
    t('Permissions'),
  ));
  $this
    ->assertNoLinkTrailByTitle(array(
    t('Site building'),
    t('Themes'),
    t('List'),
  ));

  // Verify that MENU_VISIBLE_IN_BREADCRUMB items (exact type) do NOT appear.
  $this
    ->assertNoLinkTrailByTitle(array(
    t('Site building'),
    t('Modules'),
    t('Uninstall'),
    t('Uninstall'),
  ));
  $this
    ->assertNoLinkTrailByTitle(array(
    t('Help'),
    'admin_menu',
  ));

  // Verify that special "Index" link appears below icon.
  // Note: admin_menu_menu_alter() hides this link entirely.

  /*
  $this->assertElementByXPath('//div[@id="admin-menu"]//a[contains(@href, :path) and text()=:title]', array(
    ':path' => 'admin/by-module',
    ':title' => t('By module'),
  ), "Icon » Index link found.");
  */
}