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.
*/
class ContentModerationWorkflowConfigTest extends KernelTestBase {
+ use ContentModerationTestTrait;
+
/**
* {@inheritdoc}
*/
$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')
$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);
$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.',