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

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
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 * Tests display of help block.
9 *
10 * @group help
11 */
12 class HelpBlockTest extends BrowserTestBase {
13
14 /**
15 * {@inheritdoc}
16 */
17 public static $modules = ['help', 'help_page_test', 'block', 'more_help_page_test'];
18
19 /**
20 * The help block instance.
21 *
22 * @var \Drupal\block\Entity\Block
23 */
24 protected $helpBlock;
25
26 protected function setUp() {
27 parent::setUp();
28 $this->helpBlock = $this->placeBlock('help_block');
29 }
30
31 /**
32 * Logs in users, tests help pages.
33 */
34 public function testHelp() {
35 $this->drupalGet('help_page_test/has_help');
36 $this->assertText(t('I have help!'));
37 $this->assertText($this->helpBlock->label());
38
39 $this->drupalGet('help_page_test/no_help');
40 // The help block should not appear when there is no help.
41 $this->assertNoText($this->helpBlock->label());
42
43 // Ensure that if two hook_help() implementations both return a render array
44 // the output is as expected.
45 $this->drupalGet('help_page_test/test_array');
46 $this->assertText('Help text from more_help_page_test_help module.');
47 $this->assertText('Help text from help_page_test_help module.');
48 }
49
50 }