function CommentEntityTest::setUp

Same name in other branches
  1. 8.9.x core/modules/comment/tests/src/Functional/CommentEntityTest.php \Drupal\Tests\comment\Functional\CommentEntityTest::setUp()
  2. 10 core/modules/comment/tests/src/Functional/CommentEntityTest.php \Drupal\Tests\comment\Functional\CommentEntityTest::setUp()
  3. 11.x core/modules/comment/tests/src/Functional/CommentEntityTest.php \Drupal\Tests\comment\Functional\CommentEntityTest::setUp()

Overrides CommentTestBase::setUp

File

core/modules/comment/tests/src/Functional/CommentEntityTest.php, line 47

Class

CommentEntityTest
Tests comments with other entities.

Namespace

Drupal\Tests\comment\Functional

Code

protected function setUp() : void {
    parent::setUp();
    $this->vocab = $this->createVocabulary();
    $this->commentType = CommentType::create([
        'id' => 'taxonomy_comment',
        'label' => 'Taxonomy comment',
        'description' => '',
        'target_entity_type_id' => 'taxonomy_term',
    ]);
    $this->commentType
        ->save();
    $this->addDefaultCommentField('taxonomy_term', $this->vocab
        ->id(), 'field_comment', CommentItemInterface::OPEN, $this->commentType
        ->id());
}

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