function ModerationInformationTest::testGetLatestRevisionId
@covers ::getLatestRevisionId @group legacy @expectedDeprecation Drupal\content_moderation\ModerationInformation::getLatestRevisionId is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use RevisionableStorageInterface::getLatestRevisionId() instead. See https://www.drupal.org/node/3087295
File
-
core/
modules/ content_moderation/ tests/ src/ Kernel/ ModerationInformationTest.php, line 86
Class
- ModerationInformationTest
- @coversDefaultClass \Drupal\content_moderation\ModerationInformation @group content_moderation
Namespace
Drupal\Tests\content_moderation\KernelCode
public function testGetLatestRevisionId() {
$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();
// Check that moderation information service returns the correct latest
// revision ID.
$latest_revision_id = $this->moderationInformation
->getLatestRevisionId('entity_test_rev', $entity_test_rev->id());
$this->assertSame(2, $latest_revision_id);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.