function WorkspacesContentModerationStateTest::assertDefaultRevision

Same name in other branches
  1. 9 core/modules/content_moderation/tests/src/Kernel/WorkspacesContentModerationStateTest.php \Drupal\Tests\content_moderation\Kernel\WorkspacesContentModerationStateTest::assertDefaultRevision()
  2. 8.9.x core/modules/content_moderation/tests/src/Kernel/WorkspacesContentModerationStateTest.php \Drupal\Tests\content_moderation\Kernel\WorkspacesContentModerationStateTest::assertDefaultRevision()
  3. 10 core/modules/content_moderation/tests/src/Kernel/WorkspacesContentModerationStateTest.php \Drupal\Tests\content_moderation\Kernel\WorkspacesContentModerationStateTest::assertDefaultRevision()

Overrides ContentModerationStateTest::assertDefaultRevision

File

core/modules/content_moderation/tests/src/Kernel/WorkspacesContentModerationStateTest.php, line 245

Class

WorkspacesContentModerationStateTest
Tests that Workspaces and Content Moderation work together properly.

Namespace

Drupal\Tests\content_moderation\Kernel

Code

protected function assertDefaultRevision(EntityInterface $entity, int $revision_id, $published = TRUE) : void {
    // In the context of a workspace, the default revision ID is always the
    // latest workspace-specific revision, so we need to adjust the expectation
    // of the parent assertion.
    $revision_id = (int) $this->entityTypeManager
        ->getStorage($entity->getEntityTypeId())
        ->load($entity->id())
        ->getRevisionId();
    // Additionally, the publishing status of the default revision is not
    // relevant in a workspace, because getting an entity to a "published"
    // moderation state doesn't automatically make it the default revision, so
    // we have to disable that assertion.
    $published = NULL;
    parent::assertDefaultRevision($entity, $revision_id, $published);
}

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