Mercurial > hg > isophonics-drupal-site
annotate core/modules/help/tests/src/Functional/NoHelpTest.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 129ea1e6d783 |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@0 | 3 namespace Drupal\Tests\help\Functional; |
Chris@0 | 4 |
Chris@0 | 5 use Drupal\Tests\BrowserTestBase; |
Chris@0 | 6 |
Chris@0 | 7 /** |
Chris@0 | 8 * Verify no help is displayed for modules not providing any help. |
Chris@0 | 9 * |
Chris@0 | 10 * @group help |
Chris@0 | 11 */ |
Chris@0 | 12 class NoHelpTest extends BrowserTestBase { |
Chris@0 | 13 |
Chris@0 | 14 /** |
Chris@0 | 15 * Modules to enable. |
Chris@0 | 16 * |
Chris@0 | 17 * Use one of the test modules that do not implement hook_help(). |
Chris@0 | 18 * |
Chris@17 | 19 * @var array |
Chris@0 | 20 */ |
Chris@0 | 21 public static $modules = ['help', 'menu_test']; |
Chris@0 | 22 |
Chris@0 | 23 /** |
Chris@0 | 24 * The user who will be created. |
Chris@0 | 25 */ |
Chris@0 | 26 protected $adminUser; |
Chris@0 | 27 |
Chris@0 | 28 protected function setUp() { |
Chris@0 | 29 parent::setUp(); |
Chris@0 | 30 $this->adminUser = $this->drupalCreateUser(['access administration pages']); |
Chris@0 | 31 } |
Chris@0 | 32 |
Chris@0 | 33 /** |
Chris@0 | 34 * Ensures modules not implementing help do not appear on admin/help. |
Chris@0 | 35 */ |
Chris@0 | 36 public function testMainPageNoHelp() { |
Chris@0 | 37 $this->drupalLogin($this->adminUser); |
Chris@0 | 38 |
Chris@0 | 39 $this->drupalGet('admin/help'); |
Chris@0 | 40 $this->assertResponse(200); |
Chris@0 | 41 $this->assertText('Module overviews are provided by modules'); |
Chris@0 | 42 $this->assertFalse(\Drupal::moduleHandler()->implementsHook('menu_test', 'help'), 'The menu_test module does not implement hook_help'); |
Chris@0 | 43 $this->assertNoText(\Drupal::moduleHandler()->getName('menu_test'), 'Making sure the test module menu_test does not display a help link on admin/help.'); |
Chris@0 | 44 |
Chris@0 | 45 $this->drupalGet('admin/help/menu_test'); |
Chris@0 | 46 $this->assertResponse(404, 'Getting a module overview help page for a module that does not implement hook_help() results in a 404.'); |
Chris@0 | 47 } |
Chris@0 | 48 |
Chris@0 | 49 } |