You are here

protected function ViewsModerationStateSortTest::setUp in Drupal 8

Same name and namespace in other branches
  1. 9 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()

Parameters

bool $import_test_views: Should the views specified on the test class be imported. If you need to setup some additional stuff, like fields, you need to call false and then call createTestViews for your own.

Overrides ViewsKernelTestBase::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) {
  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();
}