Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / content_moderation / tests / src / Kernel / ContentModerationWorkflowConfigTest.php
index 931056e3d67ca82ecb37d94e07de237dcd4a336d..a90c3fba963505cc3b263f2b1e5f42b6f64e8e3c 100644 (file)
@@ -6,7 +6,7 @@ use Drupal\Core\Config\ConfigImporterException;
 use Drupal\KernelTests\KernelTestBase;
 use Drupal\node\Entity\Node;
 use Drupal\node\Entity\NodeType;
-use Drupal\workflows\Entity\Workflow;
+use Drupal\Tests\content_moderation\Traits\ContentModerationTestTrait;
 
 /**
  * Tests how Content Moderation handles workflow config changes.
@@ -15,6 +15,8 @@ use Drupal\workflows\Entity\Workflow;
  */
 class ContentModerationWorkflowConfigTest extends KernelTestBase {
 
+  use ContentModerationTestTrait;
+
   /**
    * {@inheritdoc}
    */
@@ -57,13 +59,13 @@ class ContentModerationWorkflowConfigTest extends KernelTestBase {
     $this->installEntitySchema('node');
     $this->installEntitySchema('user');
     $this->installEntitySchema('content_moderation_state');
-    $this->installConfig('content_moderation');
+    $this->installConfig(['system', 'content_moderation']);
 
     NodeType::create([
       'type' => 'example',
     ])->save();
 
-    $workflow = Workflow::load('editorial');
+    $workflow = $this->createEditorialWorkflow();
     $workflow->getTypePlugin()
       ->addState('test1', 'Test one')
       ->addState('test2', 'Test two')
@@ -118,7 +120,7 @@ class ContentModerationWorkflowConfigTest extends KernelTestBase {
       $this->fail('ConfigImporterException not thrown, invalid import was not stopped due to deleted state.');
     }
     catch (ConfigImporterException $e) {
-      $this->assertEqual($e->getMessage(), 'There were errors validating the config synchronization.');
+      $this->assertEqual($e->getMessage(), 'There were errors validating the config synchronization.' . PHP_EOL . 'The moderation state Test two is being used, but is not in the source storage.');
       $error_log = $this->configImporter->getErrors();
       $expected = ['The moderation state Test two is being used, but is not in the source storage.'];
       $this->assertEqual($expected, $error_log);
@@ -132,7 +134,7 @@ class ContentModerationWorkflowConfigTest extends KernelTestBase {
       $this->fail('ConfigImporterException not thrown, invalid import was not stopped due to deleted workflow.');
     }
     catch (ConfigImporterException $e) {
-      $this->assertEqual($e->getMessage(), 'There were errors validating the config synchronization.');
+      $this->assertEqual($e->getMessage(), 'There were errors validating the config synchronization.' . PHP_EOL . 'The moderation state Test two is being used, but is not in the source storage.' . PHP_EOL . 'The workflow Editorial is being used, and cannot be deleted.');
       $error_log = $this->configImporter->getErrors();
       $expected = [
         'The moderation state Test two is being used, but is not in the source storage.',