function ViewsModerationStateSortTest::setUp

Same name and namespace in other branches
  1. 11.x core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateSortTest.php \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateSortTest::setUp()
  2. 10 core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateSortTest.php \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateSortTest::setUp()
  3. 8.9.x core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateSortTest.php \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateSortTest::setUp()

File

core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateSortTest.php, line 38

Class

ViewsModerationStateSortTest
Tests the views moderation_state field sorting integration.

Namespace

Drupal\Tests\content_moderation\Kernel

Code

protected function setUp($import_test_views = TRUE) : void {
  parent::setUp(FALSE);
  $this->installEntitySchema('user');
  $this->installEntitySchema('node');
  $this->installEntitySchema('content_moderation_state');
  $this->installEntitySchema('entity_test_no_bundle');
  $this->installSchema('node', 'node_access');
  $this->installConfig('content_moderation');
  $node_type = NodeType::create([
    'type' => 'example',
  ]);
  $node_type->save();
  ConfigurableLanguage::createFromLangcode('fr')->save();
  $workflow = $this->createEditorialWorkflow();
  $workflow->getTypePlugin()
    ->addState('zz_draft', 'ZZ Draft');
  $workflow->getTypePlugin()
    ->addState('aa_draft', 'AA Draft');
  $workflow->getTypePlugin()
    ->addEntityTypeAndBundle('node', 'example');
  $workflow->save();
}

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