You are here

protected function NodePreviewAnonymousTest::setUp in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/node/tests/src/Functional/NodePreviewAnonymousTest.php \Drupal\Tests\node\Functional\NodePreviewAnonymousTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/node/tests/src/Functional/NodePreviewAnonymousTest.php, line 31

Class

NodePreviewAnonymousTest
Tests the node entity preview functionality for anonymous user.

Namespace

Drupal\Tests\node\Functional

Code

protected function setUp() {
  parent::setUp();

  // Create Basic page node type.
  $this
    ->drupalCreateContentType([
    'type' => 'page',
    'name' => 'Basic page',
    'display_submitted' => FALSE,
  ]);

  // Grant create and editing permissions to anonymous user:
  $anonymous_role = Role::load(AccountInterface::ANONYMOUS_ROLE);
  $anonymous_role
    ->grantPermission('create page content');
  $anonymous_role
    ->save();
}