protected function ContentModerationWorkbenchEmailTest::enableTemplateForTransitionOrWorkflow in Workbench Email 8
Same name and namespace in other branches
- 2.x tests/src/Functional/ContentModerationWorkbenchEmailTest.php \Drupal\Tests\workbench_email\Functional\ContentModerationWorkbenchEmailTest::enableTemplateForTransitionOrWorkflow()
Enables template for given transition or workflow.
Return value
\Drupal\Core\Entity\EntityInterface Transition or workflow.
Overrides WorkbenchEmailTestBase::enableTemplateForTransitionOrWorkflow
File
- tests/
src/ Functional/ ContentModerationWorkbenchEmailTest.php, line 170
Class
- ContentModerationWorkbenchEmailTest
- Defines a class for testing workbench email with content moderation.
Namespace
Drupal\Tests\workbench_email\FunctionalCode
protected function enableTemplateForTransitionOrWorkflow($transition_name, $template_name) {
$this
->drupalGet('admin/config/workflow/workflows/manage/editorial');
$this
->drupalGet('admin/config/workflow/workflows/manage/editorial/transition/' . $transition_name);
$field_name = 'workbench_email_templates[' . $template_name . ']';
$this
->submitForm([
$field_name => TRUE,
], t('Save'));
$entityStorage = \Drupal::entityTypeManager()
->getStorage('workflow');
$entityStorage
->resetCache();
$workflow = $entityStorage
->load('editorial');
$this
->drupalGet('admin/config/workflow/workflows/manage/editorial/transition/' . $transition_name);
$this
->assertSession()
->checkboxChecked($field_name);
return $workflow;
}