3 namespace Drupal\Tests\node\Functional;
6 * Tests that the post information (submitted by Username on date) text displays
11 class NodePostSettingsTest extends NodeTestBase {
13 protected function setUp() {
16 $web_user = $this->drupalCreateUser(['create page content', 'administer content types', 'access user profiles']);
17 $this->drupalLogin($web_user);
21 * Confirms "Basic page" content type and post information is on a new node.
23 public function testPagePostInfo() {
25 // Set "Basic page" content type to display post information.
27 $edit['display_submitted'] = TRUE;
28 $this->drupalPostForm('admin/structure/types/manage/page', $edit, t('Save content type'));
32 $edit['title[0][value]'] = $this->randomMachineName(8);
33 $edit['body[0][value]'] = $this->randomMachineName(16);
34 $this->drupalPostForm('node/add/page', $edit, t('Save'));
36 // Check that the post information is displayed.
37 $node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
38 $elements = $this->xpath('//div[contains(@class, :class)]', [':class' => 'node__submitted']);
39 $this->assertEqual(count($elements), 1, 'Post information is displayed.');
42 // Set "Basic page" content type to display post information.
44 $edit['display_submitted'] = FALSE;
45 $this->drupalPostForm('admin/structure/types/manage/page', $edit, t('Save content type'));
49 $edit['title[0][value]'] = $this->randomMachineName(8);
50 $edit['body[0][value]'] = $this->randomMachineName(16);
51 $this->drupalPostForm('node/add/page', $edit, t('Save'));
53 // Check that the post information is displayed.
54 $elements = $this->xpath('//div[contains(@class, :class)]', [':class' => 'node__submitted']);
55 $this->assertEqual(count($elements), 0, 'Post information is not displayed.');