function NodePostSettingsTest::testPagePostInfo
Same name in other branches
- 8.9.x core/modules/node/tests/src/Functional/NodePostSettingsTest.php \Drupal\Tests\node\Functional\NodePostSettingsTest::testPagePostInfo()
- 10 core/modules/node/tests/src/Functional/NodePostSettingsTest.php \Drupal\Tests\node\Functional\NodePostSettingsTest::testPagePostInfo()
- 11.x core/modules/node/tests/src/Functional/NodePostSettingsTest.php \Drupal\Tests\node\Functional\NodePostSettingsTest::testPagePostInfo()
Confirms "Basic page" content type and post information is on a new node.
File
-
core/
modules/ node/ tests/ src/ Functional/ NodePostSettingsTest.php, line 34
Class
- NodePostSettingsTest
- Tests the node setting for displaying author and date information.
Namespace
Drupal\Tests\node\FunctionalCode
public function testPagePostInfo() {
// Set "Basic page" content type to display post information.
$edit = [];
$edit['display_submitted'] = TRUE;
$this->drupalGet('admin/structure/types/manage/page');
$this->submitForm($edit, 'Save content type');
// Create a node.
$edit = [];
$edit['title[0][value]'] = $this->randomMachineName(8);
$edit['body[0][value]'] = $this->randomMachineName(16);
$this->drupalGet('node/add/page');
$this->submitForm($edit, 'Save');
// Check that the post information is displayed.
$node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
$this->assertSession()
->pageTextContainsOnce('Submitted by');
$node->delete();
// Set "Basic page" content type to display post information.
$edit = [];
$edit['display_submitted'] = FALSE;
$this->drupalGet('admin/structure/types/manage/page');
$this->submitForm($edit, 'Save content type');
// Create a node.
$edit = [];
$edit['title[0][value]'] = $this->randomMachineName(8);
$edit['body[0][value]'] = $this->randomMachineName(16);
$this->drupalGet('node/add/page');
$this->submitForm($edit, 'Save');
// Check that the post information is not displayed.
$this->assertSession()
->pageTextNotContains('Submitted by');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.