function Upgrade6TestWithContentModeration::setUp

Same name in other branches
  1. 11.x core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6TestWithContentModeration.php \Drupal\Tests\migrate_drupal_ui\Functional\d6\Upgrade6TestWithContentModeration::setUp()

Overrides Upgrade6Test::setUp

File

core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6TestWithContentModeration.php, line 28

Class

Upgrade6TestWithContentModeration
Tests Drupal 6 upgrade using the migrate UI with Content Moderation.

Namespace

Drupal\Tests\migrate_drupal_ui\Functional\d6

Code

protected function setUp() : void {
    parent::setUp();
    // Set up a moderation flow.
    $types = [
        'story',
        'test_planet',
        'company',
        'employee',
    ];
    foreach ($types as $type) {
        $this->drupalCreateContentType([
            'type' => $type,
        ]);
    }
    $editorial = Workflow::load('editorial');
    assert($editorial instanceof WorkflowInterface);
    $type_settings = $editorial->getTypePlugin()
        ->getConfiguration();
    $type_settings['default_moderation_state'] = 'published';
    $type_settings['entity_types']['node'] = array_merge([
        'page',
    ], $types);
    $type_plugin = $editorial->getTypePlugin();
    $type_plugin->setConfiguration($type_settings);
    $editorial->trustData()
        ->save();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.