You are here

protected function CommentEntityTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 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()

Overrides CommentTestBase::setUp

File

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

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());
}