NoHelpTest.php in Drupal 10
File
core/modules/help/tests/src/Functional/NoHelpTest.php
View source
<?php
namespace Drupal\Tests\help\Functional;
use Drupal\Tests\BrowserTestBase;
class NoHelpTest extends BrowserTestBase {
protected static $modules = [
'help',
'menu_test',
];
protected $defaultTheme = 'stark';
protected $adminUser;
protected function setUp() : void {
parent::setUp();
$this->adminUser = $this
->drupalCreateUser([
'access administration pages',
]);
}
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');
$this
->assertSession()
->pageTextNotContains(\Drupal::moduleHandler()
->getName('menu_test'));
$this
->drupalGet('admin/help/menu_test');
$this
->assertSession()
->statusCodeEquals(404);
}
}
Classes
Name |
Description |
NoHelpTest |
Verify no help is displayed for modules not providing any help. |