You are here

function AdminMenuModulesTestCase::testContactModuleLinks in Administration menu 6

Test that the links are added to the page (no JS testing).

File

tests/admin_menu.test, line 77
Administration menu functionality tests.

Class

AdminMenuModulesTestCase
Test menu links depending on installed modules.

Code

function testContactModuleLinks() {

  // Create a new user without 'administer site-wide contact form' permission.
  $admin_user = $this
    ->drupalCreateUser(array(
    'access administration pages',
    'access administration menu',
  ));
  $this
    ->drupalLogin($admin_user);

  // Verify that proper links are displayed.
  $this
    ->assertRaw('<div id="admin-menu"', t('Administration menu is displayed.'));
  $this
    ->drupalGet('node');
  $this
    ->assertNoPattern('@<div id="admin-menu".*admin/build/contact@s', t('Contact module link not found.'));

  // Create a new user with 'administer site-wide contact form' permission.
  $admin_user = $this
    ->drupalCreateUser(array(
    'access administration pages',
    'access administration menu',
    'administer site-wide contact form',
  ));
  $this
    ->drupalLogin($admin_user);

  // Verify that proper links are displayed.
  $this
    ->drupalGet('node');
  $this
    ->assertPattern('@<div id="admin-menu".*admin/build/contact@s', t('Contact module link found.'));
}