class NoHelpTest
Same name and namespace in other branches
- 11.x core/modules/help/tests/src/Functional/NoHelpTest.php \Drupal\Tests\help\Functional\NoHelpTest
- 10 core/modules/help/tests/src/Functional/NoHelpTest.php \Drupal\Tests\help\Functional\NoHelpTest
- 8.9.x core/modules/help/tests/src/Functional/NoHelpTest.php \Drupal\Tests\help\Functional\NoHelpTest
Verify no help is displayed for modules not providing any help.
@group help
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\help\Functional\NoHelpTest implements \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of NoHelpTest
File
-
core/
modules/ help/ tests/ src/ Functional/ NoHelpTest.php, line 12
Namespace
Drupal\Tests\help\FunctionalView source
class NoHelpTest extends BrowserTestBase {
/**
* Modules to enable.
*
* Use one of the test modules that do not implement hook_help().
*
* @var array
*/
protected static $modules = [
'help',
'menu_test',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* The user who will be created.
*/
protected $adminUser;
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->adminUser = $this->drupalCreateUser([
'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->assertSession()
->statusCodeEquals(200);
$this->assertSession()
->pageTextContains('Module overviews are provided by modules');
$this->assertFalse(\Drupal::moduleHandler()->hasImplementations('help', 'menu_test'), 'The menu_test module does not implement hook_help');
// Make sure the test module menu_test does not display a help link on
// admin/help.
$this->assertSession()
->pageTextNotContains(\Drupal::moduleHandler()->getName('menu_test'));
// 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);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.