You are here

function HelpTestCase::testHelp in Drupal 7

Logs in users, creates dblog events, and tests dblog functionality.

File

modules/help/help.test, line 43
Tests for help.module.

Class

HelpTestCase
Tests help display and user access for all modules implementing help.

Code

function testHelp() {

  // Login the admin user.
  $this
    ->drupalLogin($this->big_user);
  $this
    ->verifyHelp();

  // Login the regular user.
  $this
    ->drupalLogin($this->any_user);
  $this
    ->verifyHelp(403);

  // Check for css on admin/help.
  $this
    ->drupalLogin($this->big_user);
  $this
    ->drupalGet('admin/help');
  $this
    ->assertRaw(drupal_get_path('module', 'help') . '/help.css', 'The help.css file is present in the HTML.');

  // Verify that introductory help text exists, goes for 100% module coverage.
  $this
    ->assertRaw(t('For more information, refer to the specific topics listed in the next section or to the <a href="@drupal">online Drupal handbooks</a>.', array(
    '@drupal' => 'http://drupal.org/documentation',
  )), 'Help intro text correctly appears.');

  // Verify that help topics text appears.
  $this
    ->assertRaw('<h2>' . t('Help topics') . '</h2><p>' . t('Help is available on the following items:') . '</p>', 'Help topics text correctly appears.');

  // Make sure links are properly added for modules implementing hook_help().
  foreach ($this->modules as $module => $name) {
    $this
      ->assertLink($name, 0, format_string('Link properly added to @name (admin/help/@module)', array(
      '@module' => $module,
      '@name' => $name,
    )));
  }
}