class AdminMenuLinkTypesTestCase

  1. nittany7 modules/contrib/admin_menu/tests/admin_menu.test AdminMenuLinkTypesTestCase
  2. cis7 modules/contrib/admin_menu/tests/admin_menu.test AdminMenuLinkTypesTestCase
  3. mooc7 modules/contrib/admin_menu/tests/admin_menu.test AdminMenuLinkTypesTestCase

Tests appearance of different types of links.

Hierarchy

Expanded class hierarchy of AdminMenuLinkTypesTestCase

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description
AdminMenuLinkTypesTestCase::getInfo public static function
AdminMenuLinkTypesTestCase::setUp function Overrides AdminMenuWebTestCase::setUp
AdminMenuLinkTypesTestCase::testLinkTypes function Tests appearance of different router item link types.
AdminMenuWebTestCase::$basePermissions protected property
AdminMenuWebTestCase::$profile protected property
AdminMenuWebTestCase::assertElementByXPath protected function Check that an element exists in HTML markup.
AdminMenuWebTestCase::assertLinkTrailByTitle protected function Asserts that links appear in the menu in a specified trail.
AdminMenuWebTestCase::assertNoElementByXPath protected function Check that an element does not exist in HTML markup.
AdminMenuWebTestCase::assertNoLinkTrailByTitle protected function Asserts that no link appears in the menu for a specified trail.

File

modules/contrib/admin_menu/tests/admin_menu.test, line 367
Tests for the Administration menu module.

View source
class AdminMenuLinkTypesTestCase extends AdminMenuWebTestCase {
  public static function getInfo() {
    return array(
      'name' => 'Link types',
      'description' => 'Tests appearance of different types of links.',
      'group' => 'Administration menu',
    );
  }

  function setUp() {
    parent::setUp(array('help'));

    $permissions = module_invoke_all('permission');
    $permissions = array_keys($permissions);
    $this->admin_user = $this->drupalCreateUser($permissions);
    $this->drupalLogin($this->admin_user);
  }

  /**
   * Tests appearance of different router item link types.
   */
  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.");
  }
}