3 namespace Drupal\Tests\node\Functional;
5 use Drupal\Tests\BrowserTestBase;
8 * Tests help functionality for nodes.
12 class NodeHelpTest extends BrowserTestBase {
19 public static $modules = ['block', 'node', 'help'];
22 * The name of the test node type to create.
29 * The test 'node help' text to be checked.
38 protected function setUp() {
42 $admin_user = $this->drupalCreateUser([
43 'administer content types',
48 $this->drupalLogin($admin_user);
49 $this->drupalPlaceBlock('help_block');
51 $this->testType = 'type';
52 $this->testText = t('Help text to find on node forms.');
54 // Create content type.
55 $this->drupalCreateContentType([
56 'type' => $this->testType,
57 'help' => $this->testText,
62 * Verifies that help text appears on node add/edit forms.
64 public function testNodeShowHelpText() {
65 // Check the node add form.
66 $this->drupalGet('node/add/' . $this->testType);
67 $this->assertResponse(200);
68 $this->assertText($this->testText);
70 // Create node and check the node edit form.
71 $node = $this->drupalCreateNode(['type' => $this->testType]);
72 $this->drupalGet('node/' . $node->id() . '/edit');
73 $this->assertResponse(200);
74 $this->assertText($this->testText);