NoHelpTest.php in Zircon Profile 8
Same filename and directory in other branches
Contains \Drupal\help\Tests\NoHelpTest.
Namespace
Drupal\help\TestsFile
core/modules/help/src/Tests/NoHelpTest.phpView source
<?php
/**
* @file
* Contains \Drupal\help\Tests\NoHelpTest.
*/
namespace Drupal\help\Tests;
use Drupal\simpletest\WebTestBase;
/**
* Verify no help is displayed for modules not providing any help.
*
* @group help
*/
class NoHelpTest extends WebTestBase {
/**
* Modules to enable.
*
* Use one of the test modules that do not implement hook_help().
*
* @var array.
*/
public static $modules = array(
'help',
'menu_test',
);
/**
* The user who will be created.
*/
protected $adminUser;
protected function setUp() {
parent::setUp();
$this->adminUser = $this
->drupalCreateUser(array(
'access administration pages',
));
}
/**
* Ensures modules not implementing help do not appear on admin/help.
*/
public function testMainPageNoHelp() {
$this
->drupalLogin($this->adminUser);
$this
->drupalGet('admin/help');
$this
->assertResponse(200);
$this
->assertText('Help is available on the following items', 'Help page is found.');
$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.');
$this
->drupalGet('admin/help/menu_test');
$this
->assertResponse(404, 'Getting a module overview help page for a module that does not implement hook_help() results in a 404.');
}
}
Classes
Name | Description |
---|---|
NoHelpTest | Verify no help is displayed for modules not providing any help. |