You are here

protected function CommentRestExportTest::setUp in Drupal 9

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

Overrides CommentTestBase::setUp

File

core/modules/comment/tests/src/Functional/Views/CommentRestExportTest.php, line 38

Class

CommentRestExportTest
Tests a comment rest export view.

Namespace

Drupal\Tests\comment\Functional\Views

Code

protected function setUp($import_test_views = TRUE) : void {
  parent::setUp($import_test_views);

  // Add another anonymous comment.
  $comment = [
    'uid' => 0,
    'entity_id' => $this->nodeUserCommented
      ->id(),
    'entity_type' => 'node',
    'field_name' => 'comment',
    'subject' => 'A lot, apparently',
    'cid' => '',
    'pid' => $this->comment
      ->id(),
    'mail' => 'someone@example.com',
    'name' => 'bobby tables',
    'hostname' => 'public.example.com',
  ];
  $this->comment = Comment::create($comment);
  $this->comment
    ->save();
  $user = $this
    ->drupalCreateUser([
    'access comments',
  ]);
  $this
    ->drupalLogin($user);
}