class NodeHelpTest
Same name and namespace in other branches
- 11.x core/modules/node/tests/src/Functional/NodeHelpTest.php \Drupal\Tests\node\Functional\NodeHelpTest
- 10 core/modules/node/tests/src/Functional/NodeHelpTest.php \Drupal\Tests\node\Functional\NodeHelpTest
- 8.9.x core/modules/node/tests/src/Functional/NodeHelpTest.php \Drupal\Tests\node\Functional\NodeHelpTest
Tests help functionality for nodes.
@group node
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\node\Functional\NodeHelpTest extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of NodeHelpTest
File
-
core/
modules/ node/ tests/ src/ Functional/ NodeHelpTest.php, line 12
Namespace
Drupal\Tests\node\FunctionalView source
class NodeHelpTest extends BrowserTestBase {
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = [
'block',
'node',
'help',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* The name of the test node type to create.
*
* @var string
*/
protected $testType;
/**
* The test 'node help' text to be checked.
*
* @var string
*/
protected $testText;
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
// Create user.
$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.';
// Create content type.
$this->drupalCreateContentType([
'type' => $this->testType,
'help' => $this->testText,
]);
}
/**
* Verifies that help text appears on node add/edit forms.
*/
public function testNodeShowHelpText() {
// Check the node add form.
$this->drupalGet('node/add/' . $this->testType);
$this->assertSession()
->statusCodeEquals(200);
$this->assertSession()
->pageTextContains($this->testText);
// Create node and check the node edit form.
$node = $this->drupalCreateNode([
'type' => $this->testType,
]);
$this->drupalGet('node/' . $node->id() . '/edit');
$this->assertSession()
->statusCodeEquals(200);
$this->assertSession()
->pageTextContains($this->testText);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.