public function ContentModerationStateTest::testContentModerationStatePendingRevisionDataRemoval in Drupal 8
Same name and namespace in other branches
- 9 core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php \Drupal\Tests\content_moderation\Kernel\ContentModerationStateTest::testContentModerationStatePendingRevisionDataRemoval()
Tests removal of content moderation state pending entity revisions.
@dataProvider basicModerationTestCases
File
- core/
modules/ content_moderation/ tests/ src/ Kernel/ ContentModerationStateTest.php, line 230
Class
- ContentModerationStateTest
- Tests links between a content entity and a content_moderation_state entity.
Namespace
Drupal\Tests\content_moderation\KernelCode
public function testContentModerationStatePendingRevisionDataRemoval($entity_type_id) {
$entity = $this
->createEntity($entity_type_id, 'published');
$entity
->setNewRevision(TRUE);
$entity->moderation_state = 'draft';
$entity
->save();
$content_moderation_state = ContentModerationState::loadFromModeratedEntity($entity);
$this
->assertNotEmpty($content_moderation_state);
$entity_storage = $this->entityTypeManager
->getStorage($entity_type_id);
$entity_storage
->deleteRevision($entity
->getRevisionId());
$content_moderation_state = ContentModerationState::loadFromModeratedEntity($entity);
$this
->assertNull($content_moderation_state);
}