You are here

public function AdminMenuCustomizedTestCase::testCustomExternal in Administration menu 7.3

Tests external links.

File

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

Class

AdminMenuCustomizedTestCase
Tests customized menu links.

Code

public function testCustomExternal() {

  // Add a custom link to the node to the menu.
  $edit = array(
    'link_path' => 'http://example.com',
    'link_title' => 'Example',
    'parent' => 'management:' . $this
      ->queryMlidByPath('admin'),
  );
  $this
    ->drupalPost('admin/structure/menu/manage/management/add', $edit, t('Save'));

  // Verify that the link appears in the menu.
  $this
    ->drupalGet('');
  $elements = $this
    ->xpath('//div[@id=:id]//a[@href=:href and contains(text(), :text)]', array(
    ':id' => 'admin-menu',
    ':href' => $edit['link_path'],
    ':text' => $edit['link_title'],
  ));
  $this
    ->assertTrue($elements, 'External link found.');
}