public function InstallTest::testInstallWorkflow in Lightning Layout 8
Same name and namespace in other branches
- 8.2 modules/lightning_landing_page/tests/src/Kernel/InstallTest.php \Drupal\Tests\lightning_landing_page\Kernel\InstallTest::testInstallWorkflow()
Tests installing Lightning Workflow.
Parameters
bool $should_apply: (optional) Whether or not the workflow will apply to the landing_page content type. Defaults to TRUE.
1 call to InstallTest::testInstallWorkflow()
- InstallTest::testInstallWorkflowDuringSync in modules/
lightning_landing_page/ tests/ src/ Kernel/ InstallTest.php - Tests installing Lightning Workflow during config sync.
File
- modules/
lightning_landing_page/ tests/ src/ Kernel/ InstallTest.php, line 34
Class
- InstallTest
- Tests installation of Lightning Landing Page.
Namespace
Drupal\Tests\lightning_landing_page\KernelCode
public function testInstallWorkflow($should_apply = TRUE) {
// The module should not directly react to the installation of
// lightning_workflow.
lightning_landing_page_modules_installed([
'lightning_workflow',
]);
// Create a fake module handler which will report that lightning_workflow
// is installed. It is too cumbersome to bring it in as a real dev
// dependency, so this is a decent way to hack it.
$this->container
->set('module_handler', new TestModuleHandler($this->root, $this->container
->getParameter('container.modules'), new NullBackend('discovery')));
Workflow::create([
'id' => 'editorial',
'label' => 'Editorial',
'type' => 'content_moderation',
])
->save();
/** @var \Drupal\content_moderation\Plugin\WorkflowType\ContentModerationInterface $type_plugin */
$type_plugin = Workflow::load('editorial')
->getTypePlugin();
$this
->assertSame($should_apply, $type_plugin
->appliesToEntityTypeAndBundle('node', 'landing_page'));
}