function NodePreviewAnonymousTest::testAnonymousPagePreview
Same name in other branches
- 9 core/modules/node/tests/src/Functional/NodePreviewAnonymousTest.php \Drupal\Tests\node\Functional\NodePreviewAnonymousTest::testAnonymousPagePreview()
- 8.9.x core/modules/node/tests/src/Functional/NodePreviewAnonymousTest.php \Drupal\Tests\node\Functional\NodePreviewAnonymousTest::testAnonymousPagePreview()
- 11.x core/modules/node/tests/src/Functional/NodePreviewAnonymousTest.php \Drupal\Tests\node\Functional\NodePreviewAnonymousTest::testAnonymousPagePreview()
Checks the node preview functionality for anonymous users.
File
-
core/
modules/ node/ tests/ src/ Functional/ NodePreviewAnonymousTest.php, line 51
Class
- NodePreviewAnonymousTest
- Tests the node entity preview functionality for anonymous user.
Namespace
Drupal\Tests\node\FunctionalCode
public function testAnonymousPagePreview() : void {
$title_key = 'title[0][value]';
$body_key = 'body[0][value]';
// Fill in node creation form and preview node.
$edit = [
$title_key => $this->randomMachineName(),
$body_key => $this->randomMachineName(),
];
$this->drupalGet('node/add/page');
$this->submitForm($edit, 'Preview');
// Check that the preview is displaying the title, body and term.
$this->assertSession()
->linkExists('Back to content editing');
$this->assertSession()
->responseContains($edit[$body_key]);
$this->assertSession()
->titleEquals($edit[$title_key] . ' | Drupal');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.