public function ModerationInformationTest::testGetDefaultRevisionId in Drupal 8
Same name and namespace in other branches
- 9 core/modules/content_moderation/tests/src/Kernel/ModerationInformationTest.php \Drupal\Tests\content_moderation\Kernel\ModerationInformationTest::testGetDefaultRevisionId()
@covers ::getDefaultRevisionId
File
- core/
modules/ content_moderation/ tests/ src/ Kernel/ ModerationInformationTest.php, line 64
Class
- ModerationInformationTest
- @coversDefaultClass \Drupal\content_moderation\ModerationInformation @group content_moderation
Namespace
Drupal\Tests\content_moderation\KernelCode
public function testGetDefaultRevisionId() {
$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 default
// revision ID.
$default_revision_id = $this->moderationInformation
->getDefaultRevisionId('entity_test_rev', $entity_test_rev
->id());
$this
->assertSame(1, $default_revision_id);
}