You are here

public function CommentLegacyTest::testGetStatus in Drupal 8

Tests the getStatus() method.

@expectedDeprecation Drupal\comment\Entity\Comment::getStatus() is deprecated in drupal:8.3.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityPublishedInterface::isPublished() instead. See https://www.drupal.org/node/2830201

File

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

Class

CommentLegacyTest
Tests legacy comment functionality.

Namespace

Drupal\Tests\comment\Kernel

Code

public function testGetStatus() {
  $entity = $this
    ->createComment();
  $entity
    ->setPublished();
  $this
    ->assertEquals(CommentInterface::PUBLISHED, $entity
    ->getStatus());
  $entity
    ->setUnPublished();
  $this
    ->assertEquals(CommentInterface::NOT_PUBLISHED, $entity
    ->getStatus());
}