public function ModerationInformationTest::testGetLatestRevision in Drupal 8
@covers ::getLatestRevision @group legacy @expectedDeprecation Drupal\content_moderation\ModerationInformation::getLatestRevision is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use RevisionableStorageInterface::getLatestRevisionId() and RevisionableStorageInterface::loadRevision() instead. See https://www.drupal.org/node/3087295
File
- core/
modules/ content_moderation/ tests/ src/ Kernel/ ModerationInformationTest.php, line 108
Class
- ModerationInformationTest
- @coversDefaultClass \Drupal\content_moderation\ModerationInformation @group content_moderation
Namespace
Drupal\Tests\content_moderation\KernelCode
public function testGetLatestRevision() {
$entity_test_rev = EntityTestRev::create([
'name' => 'Default Revision',
'moderation_state' => 'published',
]);
$entity_test_rev
->save();
$entity_test_rev->name = 'Pending revision';
$entity_test_rev->moderation_state = 'draft';
$entity_test_rev
->save();
$latest_revision = $this->moderationInformation
->getLatestRevision('entity_test_rev', $entity_test_rev
->id());
$this
->assertEquals(2, $latest_revision
->getRevisionId());
}