diff --git a/core/modules/node/tests/src/Functional/NodeCreationTest.php b/core/modules/node/tests/src/Functional/NodeCreationTest.php index 9ceb884..4d24901 100644 --- a/core/modules/node/tests/src/Functional/NodeCreationTest.php +++ b/core/modules/node/tests/src/Functional/NodeCreationTest.php @@ -41,7 +41,6 @@ public function testNodeCreation() { $this->drupalGet('node/add'); $this->assertResponse(200); $this->assertUrl('node/add/page'); - $this->assertText('Not saved yet'); // Create a node. $edit = []; $edit['title[0][value]'] = $this->randomMachineName(8); diff --git a/core/modules/node/tests/src/Functional/NodeEditFormTest.php b/core/modules/node/tests/src/Functional/NodeEditFormTest.php index c43fffc..c15ca70 100644 --- a/core/modules/node/tests/src/Functional/NodeEditFormTest.php +++ b/core/modules/node/tests/src/Functional/NodeEditFormTest.php @@ -77,8 +77,6 @@ public function testNodeEdit() { $this->assertRaw('Edit(active tab)', 'Edit tab found and marked active.'); $this->assertFieldByName($title_key, $edit[$title_key], 'Title field displayed.'); $this->assertFieldByName($body_key, $edit[$body_key], 'Body field displayed.'); - $this->assertText('Published'); - $this->assertText(format_date($node->getChangedTime(), 'short')); // Edit the content of the node. $edit = []; @@ -202,6 +200,43 @@ public function testNodeEditAuthoredBy() { } /** + * Tests the node meta information. + */ + public function testNodeMetaInformation() { + // Check that regular users (i.e. without the 'administer nodes' permission) + // can not see the meta information. + $this->drupalLogin($this->webUser); + $this->drupalGet('node/add/page'); + $this->assertNoText('Not saved yet'); + + // Create node to edit. + $edit['title[0][value]'] = $this->randomMachineName(8); + $edit['body[0][value]'] = $this->randomMachineName(16); + $this->drupalPostForm(NULL, $edit, t('Save')); + + $node = $this->drupalGetNodeByTitle($edit['title[0][value]']); + $this->drupalGet("node/" . $node->id() . "/edit"); + $this->assertNoText('Published'); + $this->assertNoText(format_date($node->getChangedTime(), 'short')); + + // Check that users with the 'administer nodes' permission can see the meta + // information. + $this->drupalLogin($this->adminUser); + $this->drupalGet('node/add/page'); + $this->assertText('Not saved yet'); + + // Create node to edit. + $edit['title[0][value]'] = $this->randomMachineName(8); + $edit['body[0][value]'] = $this->randomMachineName(16); + $this->drupalPostForm(NULL, $edit, t('Save')); + + $node = $this->drupalGetNodeByTitle($edit['title[0][value]']); + $this->drupalGet("node/" . $node->id() . "/edit"); + $this->assertText('Published'); + $this->assertText(format_date($node->getChangedTime(), 'short')); + } + + /** * Checks that the "authored by" works correctly with various values. * * @param \Drupal\node\NodeInterface $node