Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / content_moderation / tests / src / Functional / ModerationFormTest.php
index bb9e92d6ea5409c0f0dde816bdf61b70bcfa0cc2..9f3c401e632bbd74d23eac4939a67d9042f45924 100644 (file)
@@ -3,7 +3,6 @@
 namespace Drupal\Tests\content_moderation\Functional;
 
 use Drupal\Core\Entity\Entity\EntityFormDisplay;
-use Drupal\workflows\Entity\Workflow;
 use Drupal\Core\Url;
 
 /**
@@ -107,6 +106,10 @@ class ModerationFormTest extends ModerationStateTestBase {
       'moderation_state[0][state]' => 'published',
     ], t('Save'));
 
+    // Check widget default value.
+    $this->drupalGet($edit_path);
+    $this->assertFieldByName('moderation_state[0][state]', 'published', 'The moderation default value is set correctly.');
+
     // The published view should not have a moderation form, because it is the
     // live revision.
     $this->drupalGet($canonical_path);
@@ -153,9 +156,8 @@ class ModerationFormTest extends ModerationStateTestBase {
    */
   public function testNonBundleModerationForm() {
     $this->drupalLogin($this->rootUser);
-    $workflow = Workflow::load('editorial');
-    $workflow->getTypePlugin()->addEntityTypeAndBundle('entity_test_mulrevpub', 'entity_test_mulrevpub');
-    $workflow->save();
+    $this->workflow->getTypePlugin()->addEntityTypeAndBundle('entity_test_mulrevpub', 'entity_test_mulrevpub');
+    $this->workflow->save();
 
     // Create new moderated content in draft.
     $this->drupalPostForm('entity_test_mulrevpub/add', ['moderation_state[0][state]' => 'draft'], t('Save'));
@@ -469,7 +471,7 @@ class ModerationFormTest extends ModerationStateTestBase {
       'edit own moderated_content content',
       'use editorial transition create_new_draft',
       'use editorial transition publish',
-      'use editorial transition archive'
+      'use editorial transition archive',
     ]);
     $this->drupalLogin($user);
     $paths = [