You are here

protected function CommentLegacyTest::createComment in Drupal 8

Constructs comment entity.

Return value

\Drupal\comment\CommentInterface Created comment entity.

2 calls to CommentLegacyTest::createComment()
CommentLegacyTest::testCommentView in core/modules/comment/tests/src/Kernel/CommentLegacyTest.php
@expectedDeprecation comment_view() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal::entityTypeManager()->getViewBuilder('comment')->view() instead. See…
CommentLegacyTest::testGetStatus in core/modules/comment/tests/src/Kernel/CommentLegacyTest.php
Tests the getStatus() method.

File

core/modules/comment/tests/src/Kernel/CommentLegacyTest.php, line 71

Class

CommentLegacyTest
Tests legacy comment functionality.

Namespace

Drupal\Tests\comment\Kernel

Code

protected function createComment() {
  return Comment::create([
    'entity_type' => 'entity_test',
    'field_name' => 'comments',
    'entity_id' => $this->entity
      ->id(),
    'comment_type' => 'comment',
  ]);
}