class NoHelpTest
Same name in this branch
- 11.x core/modules/help/tests/src/Functional/NoHelpTest.php \Drupal\Tests\help\Functional\NoHelpTest
Same name and namespace in other branches
- 10 core/modules/help/tests/src/Functional/NoHelpTest.php \Drupal\Tests\help\Functional\NoHelpTest
- 9 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
- main core/modules/help/tests/src/Functional/NoHelpTest.php \Drupal\Tests\help\Functional\NoHelpTest
Verify no help is displayed for modules not providing any help.
Attributes
#[Group('help')]
#[RunTestsInSeparateProcesses]
Hierarchy
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\Tests\DrupalTestCaseTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\PhpUnitCompatibilityTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait, \Drupal\Tests\BrowserHtmlDebugTrait, \Drupal\Tests\HttpKernelUiHelperTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\help\Kernel\NoHelpTest uses \Drupal\Tests\HttpKernelUiHelperTrait, \Drupal\Tests\user\Traits\UserCreationTrait extends \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of NoHelpTest
File
-
core/
modules/ help/ tests/ src/ Kernel/ NoHelpTest.php, line 16
Namespace
Drupal\Tests\help\KernelView source
class NoHelpTest extends KernelTestBase {
use HttpKernelUiHelperTrait;
use UserCreationTrait;
/**
* Modules to install.
*
* Use one of the test modules that do not implement hook_help().
*
* @var array
*/
protected static $modules = [
'help',
'menu_test',
'user',
'system',
];
/**
* The user who will be created.
*
* @var \Drupal\user\Entity\User|false
*/
protected $adminUser;
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->installEntitySchema('user');
$this->adminUser = $this->createUser([
'access help pages',
]);
$this->setCurrentUser($this->adminUser);
}
/**
* Ensures modules not implementing help do not appear on admin/help.
*/
public function testMainPageNoHelp() : void {
$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::service('extension.list.module')->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.