public function DefaultContentModerationStateRevisionUpdateTest::testUpdateDefaultRevision in Drupal 8
Test updating the default revision.
File
- core/
modules/ content_moderation/ tests/ src/ Functional/ Update/ DefaultContentModerationStateRevisionUpdateTest.php, line 30
Class
- DefaultContentModerationStateRevisionUpdateTest
- Test updating the ContentModerationState entity default revisions.
Namespace
Drupal\Tests\content_moderation\Functional\UpdateCode
public function testUpdateDefaultRevision() {
// Include the database fixture required to test updating the default
// revision. This is excluded from ::setDatabaseDumpFiles so that we can
// test the same post_update hook with no test content enabled.
require __DIR__ . '/../../../fixtures/update/drupal-8.default-cms-entity-id-2941736.php';
$this
->runUpdates();
foreach ([
'node',
'block_content',
] as $entity_type_id) {
$draft_pending_revision = $this
->getEntityByLabel($entity_type_id, 'draft pending revision');
$this
->assertFalse($draft_pending_revision
->isLatestRevision());
$this
->assertCompositeEntityMatchesDefaultRevisionId($draft_pending_revision);
$published_default_revision = $this
->getEntityByLabel($entity_type_id, 'published default revision');
$this
->assertTrue($published_default_revision
->isLatestRevision());
$this
->assertCompositeEntityMatchesDefaultRevisionId($published_default_revision);
$archived_default_revision = $this
->getEntityByLabel($entity_type_id, 'archived default revision');
$this
->assertTrue($archived_default_revision
->isLatestRevision());
$this
->assertCompositeEntityMatchesDefaultRevisionId($archived_default_revision);
}
}