protected function ViewsModerationStateFilterTest::setUp in Drupal 9
Same name in this branch
- 9 core/modules/content_moderation/tests/src/Functional/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Functional\ViewsModerationStateFilterTest::setUp()
- 9 core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateFilterTest::setUp()
Same name and namespace in other branches
- 8 core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateFilterTest::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/ ViewsModerationStateFilterTest.php, line 44
Class
- ViewsModerationStateFilterTest
- Tests the views 'moderation_state_filter' filter plugin.
Namespace
Drupal\Tests\content_moderation\KernelCode
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();
$node_type = NodeType::create([
'type' => 'another_example',
]);
$node_type
->save();
$node_type = NodeType::create([
'type' => 'example_non_moderated',
]);
$node_type
->save();
$workflow = $this
->createEditorialWorkflow();
$workflow
->getTypePlugin()
->addEntityTypeAndBundle('node', 'example');
$workflow
->save();
// Install the test views after moderation has been enabled on the example
// bundle, so the moderation_state field exists.
$this
->installConfig('content_moderation_test_views');
ConfigurableLanguage::createFromLangcode('fr')
->save();
}