You are here

protected function ContentModerationStateTest::assertDefaultRevision in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php \Drupal\Tests\content_moderation\Kernel\ContentModerationStateTest::assertDefaultRevision()

Checks the default revision ID and publishing status for an entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: An entity object.

int $revision_id: The expected revision ID.

bool|null $published: (optional) Whether to check if the entity is published or not. Defaults to TRUE.

3 calls to ContentModerationStateTest::assertDefaultRevision()
ContentModerationStateTest::testBasicModeration in core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php
Tests basic monolingual content moderation through the API.
ContentModerationStateTest::testMultilingualModeration in core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php
Tests basic multilingual content moderation through the API.
WorkspacesContentModerationStateTest::assertDefaultRevision in core/modules/content_moderation/tests/src/Kernel/WorkspacesContentModerationStateTest.php
Checks the default revision ID and publishing status for an entity.
1 method overrides ContentModerationStateTest::assertDefaultRevision()
WorkspacesContentModerationStateTest::assertDefaultRevision in core/modules/content_moderation/tests/src/Kernel/WorkspacesContentModerationStateTest.php
Checks the default revision ID and publishing status for an entity.

File

core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php, line 790

Class

ContentModerationStateTest
Tests links between a content entity and a content_moderation_state entity.

Namespace

Drupal\Tests\content_moderation\Kernel

Code

protected function assertDefaultRevision(EntityInterface $entity, $revision_id, $published = TRUE) {

  // Get the default revision.
  $entity = $this
    ->reloadEntity($entity);
  $this
    ->assertEquals($revision_id, $entity
    ->getRevisionId());
  if ($published !== NULL && $entity instanceof EntityPublishedInterface) {
    $this
      ->assertSame($published, $entity
      ->isPublished());
  }
}