Skip to content
Snippets Groups Projects
Commit 95e9b9ec authored by cilefen's avatar cilefen
Browse files

Issue #2845113 by timmillwood, tstoeckler: Add test coverage that setting an...

Issue #2845113 by timmillwood, tstoeckler: Add test coverage that setting an invalid moderation state on a moderated entity fails
parent 4417b82c
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
use Drupal\content_moderation\Entity\ContentModerationState; use Drupal\content_moderation\Entity\ContentModerationState;
use Drupal\Core\Entity\EntityPublishedInterface; use Drupal\Core\Entity\EntityPublishedInterface;
use Drupal\Core\Entity\EntityStorageException;
use Drupal\entity_test\Entity\EntityTestBundle; use Drupal\entity_test\Entity\EntityTestBundle;
use Drupal\entity_test\Entity\EntityTestWithBundle; use Drupal\entity_test\Entity\EntityTestWithBundle;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
...@@ -151,6 +152,11 @@ public function testBasicModeration($entity_type_id) { ...@@ -151,6 +152,11 @@ public function testBasicModeration($entity_type_id) {
if ($entity instanceof EntityPublishedInterface) { if ($entity instanceof EntityPublishedInterface) {
$this->assertTrue($entity->isPublished()); $this->assertTrue($entity->isPublished());
} }
// Set an invalid moderation state.
$this->setExpectedException(EntityStorageException::class);
$entity->moderation_state->value = 'foobar';
$entity->save();
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment