diff --git a/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php b/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php index db80eea..1ed85ab 100644 --- a/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php +++ b/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php @@ -399,6 +399,36 @@ public function testMultilingualModeration() { } /** + * Test moderation when the moderation_state field has a config override. + */ + public function testModerationWithFieldConfigOverride() { + NodeType::create([ + 'type' => 'test_type', + ])->save(); + + $workflow = Workflow::load('editorial'); + $workflow->getTypePlugin()->addEntityTypeAndBundle('node', 'test_type'); + $workflow->save(); + + $fields = $this->container->get('entity_field.manager')->getFieldDefinitions('node', 'test_type'); + $field_config = $fields['moderation_state']->getConfig('test_type'); + $field_config->setLabel('Field Override!'); + $field_config->save(); + + $node = Node::create([ + 'title' => 'Test node', + 'type' => 'test_type', + 'moderation_state' => 'published', + ]); + $node->save(); + $this->assertTrue($node->isPublished()); + + $node->moderation_state = 'draft'; + $node->save(); + $this->assertFalse($node->isPublished()); + } + + /** * Tests that entities with special languages can be moderated. */ public function testModerationWithSpecialLanguages() {