public function ModerationInformationTest::testIsLatestRevision in Drupal 8
@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\KernelCode
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));
}