summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2018-05-17 09:48:51 (GMT)
committerAlex Pott2018-05-17 09:48:51 (GMT)
commitadd4d395079a026801ad817cd7c29a244c8d3062 (patch)
tree93a518e6cd576b212ed22d526a2e5a9d2fff72bf
parent7c6d4449d16676d4ee5d0511916014af19903f15 (diff)
Issue #2973493 by Sam152: Remove @todo in content_moderation related to NULL values of the moderation_state field
-rw-r--r--core/modules/content_moderation/src/EntityOperations.php1
-rw-r--r--core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php3
2 files changed, 3 insertions, 1 deletions
diff --git a/core/modules/content_moderation/src/EntityOperations.php b/core/modules/content_moderation/src/EntityOperations.php
index e268860..240fd6a 100644
--- a/core/modules/content_moderation/src/EntityOperations.php
+++ b/core/modules/content_moderation/src/EntityOperations.php
@@ -203,7 +203,6 @@ class EntityOperations implements ContainerInjectionInterface {
$moderation_state = $workflow->getTypePlugin()->getInitialState($entity)->id();
}
- // @todo what if $entity->moderation_state is null at this point?
$content_moderation_state->set('content_entity_revision_id', $entity_revision_id);
$content_moderation_state->set('moderation_state', $moderation_state);
ContentModerationStateEntity::updateOrCreateFromEntity($content_moderation_state);
diff --git a/core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php b/core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php
index ce78aa9..c45f1f9 100644
--- a/core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php
+++ b/core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php
@@ -111,6 +111,9 @@ class ModerationStateFieldItemListTest extends KernelTestBase {
unset($this->testNode->moderation_state);
$this->assertEquals('draft', $this->testNode->moderation_state->value);
+
+ $this->testNode->moderation_state = NULL;
+ $this->assertEquals('draft', $this->testNode->moderation_state->value);
}
/**