diff --git a/core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php b/core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php index 0e74b1ae0e..92423626c5 100644 --- a/core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php +++ b/core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php @@ -401,4 +401,33 @@ public function testWithExistingUnmoderatedContent() { $this->assertEquals('published', $translation->moderation_state->value); } + /** + * Tests field item list translation support with unmoderated content. + */ + public function testTranslationWithExistingUnmoderatedContent() { + $node = Node::create([ + 'title' => 'Published en', + 'langcode' => 'en', + 'type' => 'unmoderated', + ]); + $node->setPublished(); + $node->save(); + + $workflow = Workflow::load('editorial'); + $workflow->getTypePlugin()->addEntityTypeAndBundle('node', 'unmoderated'); + $workflow->save(); + + $translation = $node->addTranslation('de'); + $translation->moderation_state = 'draft'; + $translation->save(); + + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); + $node = $node_storage->loadRevision($node_storage->getLatestRevisionId($node->id())); + + $this->assertEquals('published', $node->moderation_state->value); + $this->assertEquals('draft', $translation->moderation_state->value); + $this->assertTrue($node->isPublished()); + $this->assertFalse($translation->isPublished()); + } + }