function 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 46
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',
'name' => 'Example',
]);
$node_type->save();
$node_type = NodeType::create([
'type' => 'another_example',
'name' => 'Another Example',
]);
$node_type->save();
$node_type = NodeType::create([
'type' => 'example_non_moderated',
'name' => 'Non-Moderated Example',
]);
$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();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.