comparison core/modules/help/tests/src/Functional/NoHelpTest.php @ 0:4c8ae668cc8c

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