You are here

protected function WorkbenchTransitionEmailTest::enableTemplateForTransitionOrWorkflow in Workbench Email 8

Same name and namespace in other branches
  1. 2.x tests/src/Functional/WorkbenchTransitionEmailTest.php \Drupal\Tests\workbench_email\Functional\WorkbenchTransitionEmailTest::enableTemplateForTransitionOrWorkflow()

Enables template for given transition or workflow.

Return value

\Drupal\Core\Entity\EntityInterface Transition or workflow.

Overrides WorkbenchEmailTestBase::enableTemplateForTransitionOrWorkflow

File

tests/src/Functional/WorkbenchTransitionEmailTest.php, line 92

Class

WorkbenchTransitionEmailTest
Tests the view access control handler for moderation state entities.

Namespace

Drupal\Tests\workbench_email\Functional

Code

protected function enableTemplateForTransitionOrWorkflow($transition_name, $template_name) {
  $this
    ->drupalGet('admin/structure/workbench-moderation/transitions/' . $transition_name);
  $field_name = 'workbench_email_templates[' . $template_name . ']';
  $this
    ->submitForm([
    $field_name => TRUE,
  ], t('Save'));
  \Drupal::entityTypeManager()
    ->getStorage('moderation_state_transition')
    ->resetCache();
  $transition = ModerationStateTransition::load($transition_name);
  $this
    ->assertEquals([
    $template_name => $template_name,
  ], $transition
    ->getThirdPartySetting('workbench_email', 'workbench_email_templates', []));
  $this
    ->drupalGet('admin/structure/workbench-moderation/transitions/' . $transition_name);
  $this
    ->assertSession()
    ->checkboxChecked($field_name);
  return $transition;
}