public function HelpTest::testHelp

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

File

drupal/core/modules/help/lib/Drupal/help/Tests/HelpTest.php, line 58
Definition of Drupal\help\Tests\HelpTest.

Class

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

Namespace

Drupal\help\Tests

Code

public function testHelp() {

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

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

  // Check for css on admin/help.
  $this
    ->drupalLogin($this->adminUser);
  $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
    ->getModuleList() as $module => $name) {
    $this
      ->assertLink($name, 0, format_string('Link properly added to @name (admin/help/@module)', array(
      '@module' => $module,
      '@name' => $name,
    )));
  }
}