function NodePreviewAnonymousTest::setUp
Same name in other branches
- 9 core/modules/node/tests/src/Functional/NodePreviewAnonymousTest.php \Drupal\Tests\node\Functional\NodePreviewAnonymousTest::setUp()
- 8.9.x core/modules/node/tests/src/Functional/NodePreviewAnonymousTest.php \Drupal\Tests\node\Functional\NodePreviewAnonymousTest::setUp()
- 11.x 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 33
Class
- NodePreviewAnonymousTest
- Tests the node entity preview functionality for anonymous user.
Namespace
Drupal\Tests\node\FunctionalCode
protected function setUp() : void {
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();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.