You are here

protected function CommentAccessTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/comment/tests/src/Functional/CommentAccessTest.php \Drupal\Tests\comment\Functional\CommentAccessTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/comment/tests/src/Functional/CommentAccessTest.php, line 42

Class

CommentAccessTest
Tests comment administration and preview access.

Namespace

Drupal\Tests\comment\Functional

Code

protected function setUp() : void {
  parent::setUp();
  $node_type = NodeType::create([
    'type' => 'article',
    'name' => 'Article',
  ]);
  $node_type
    ->save();
  $node_author = $this
    ->drupalCreateUser([
    'create article content',
    'access comments',
  ]);
  $this
    ->drupalLogin($this
    ->drupalCreateUser([
    'edit own comments',
    'skip comment approval',
    'post comments',
    'access comments',
    'access content',
  ]));
  $this
    ->addDefaultCommentField('node', 'article');
  $this->unpublishedNode = $this
    ->createNode([
    'title' => 'This is unpublished',
    'uid' => $node_author
      ->id(),
    'status' => 0,
    'type' => 'article',
  ]);
  $this->unpublishedNode
    ->save();
}