NodeHelpTest.php in Drupal 9
File
core/modules/node/tests/src/Functional/NodeHelpTest.php
View source
<?php
namespace Drupal\Tests\node\Functional;
use Drupal\Tests\BrowserTestBase;
class NodeHelpTest extends BrowserTestBase {
protected static $modules = [
'block',
'node',
'help',
];
protected $defaultTheme = 'stark';
protected $testType;
protected $testText;
protected function setUp() : void {
parent::setUp();
$admin_user = $this
->drupalCreateUser([
'administer content types',
'administer nodes',
'bypass node access',
]);
$this
->drupalLogin($admin_user);
$this
->drupalPlaceBlock('help_block');
$this->testType = 'type';
$this->testText = 'Help text to find on node forms.';
$this
->drupalCreateContentType([
'type' => $this->testType,
'help' => $this->testText,
]);
}
public function testNodeShowHelpText() {
$this
->drupalGet('node/add/' . $this->testType);
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->pageTextContains($this->testText);
$node = $this
->drupalCreateNode([
'type' => $this->testType,
]);
$this
->drupalGet('node/' . $node
->id() . '/edit');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->pageTextContains($this->testText);
}
}