function ModerationInformationTest::testIsLatestRevision

@covers ::isLatestRevision @group legacy @expectedDeprecation Drupal\content_moderation\ModerationInformation::isLatestRevision is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use RevisionableInterface::isLatestRevision() instead. See https://www.drupal.org/node/3087295

File

core/modules/content_moderation/tests/src/Kernel/ModerationInformationTest.php, line 128

Class

ModerationInformationTest
@coversDefaultClass \Drupal\content_moderation\ModerationInformation @group content_moderation

Namespace

Drupal\Tests\content_moderation\Kernel

Code

public function testIsLatestRevision() {
    $entity_test_rev = EntityTestRev::create([
        'name' => 'Default Revision',
        'moderation_state' => 'published',
    ]);
    $entity_test_rev->save();
    $old_revision = clone $entity_test_rev;
    $entity_test_rev->name = 'Pending revision';
    $entity_test_rev->moderation_state = 'draft';
    $entity_test_rev->save();
    $this->assertFalse($this->moderationInformation
        ->isLatestRevision($old_revision));
    $this->assertTrue($this->moderationInformation
        ->isLatestRevision($entity_test_rev));
}

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