You are here

public function AdminMenuLinkTypesTestCase::testLinkTypes in Administration menu 7.3

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

Tests appearance of different router item link types.

File

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

Class

AdminMenuLinkTypesTestCase
Tests appearance of different types of links.

Code

public function testLinkTypes() {

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

  // Verify that MENU_LOCAL_TASKs appear.
  $this
    ->assertLinkTrailByTitle(array(
    t('People'),
    t('Permissions'),
  ));
  $this
    ->assertLinkTrailByTitle(array(
    t('Appearance'),
    t('Settings'),
  ));
  $this
    ->assertLinkTrailByTitle(array(
    t('Modules'),
    t('Uninstall'),
  ));

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

  // Verify that MENU_DEFAULT_LOCAL_TASKs do NOT appear.
  $this
    ->assertNoLinkTrailByTitle(array(
    t('Modules'),
    t('List'),
  ));
  $this
    ->assertNoLinkTrailByTitle(array(
    t('People'),
    t('List'),
  ));
  $this
    ->assertNoLinkTrailByTitle(array(
    t('People'),
    t('Permissions'),
    t('Permissions'),
  ));
  $this
    ->assertNoLinkTrailByTitle(array(
    t('Appearance'),
    t('List'),
  ));

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

  // Verify that special "Index" link appears below icon.
  $this
    ->assertElementByXPath('//div[@id="admin-menu"]//a[contains(@href, :path) and text()=:title]', array(
    ':path' => 'admin/index',
    ':title' => t('Index'),
  ), "Icon » Index link found.");
}