function 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) {
    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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.