You are here

public function NoHelpTest::testMainPageNoHelp in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/help/tests/src/Functional/NoHelpTest.php \Drupal\Tests\help\Functional\NoHelpTest::testMainPageNoHelp()

Ensures modules not implementing help do not appear on admin/help.

File

core/modules/help/tests/src/Functional/NoHelpTest.php, line 41

Class

NoHelpTest
Verify no help is displayed for modules not providing any help.

Namespace

Drupal\Tests\help\Functional

Code

public function testMainPageNoHelp() {
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet('admin/help');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertText('Module overviews are provided by modules');
  $this
    ->assertFalse(\Drupal::moduleHandler()
    ->implementsHook('menu_test', 'help'), 'The menu_test module does not implement hook_help');
  $this
    ->assertNoText(\Drupal::moduleHandler()
    ->getName('menu_test'), 'Making sure the test module menu_test does not display a help link on admin/help.');

  // Ensure that the module overview help page for a module that does not
  // implement hook_help() results in a 404.
  $this
    ->drupalGet('admin/help/menu_test');
  $this
    ->assertSession()
    ->statusCodeEquals(404);
}