function ViewsModerationStateSortTest::setUp

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

Overrides ViewsKernelTestBase::setUp

File

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

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',
        'name' => '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.