You are here

protected function ContentModerationNotificationTestTrait::enableModeration in Content Moderation Notifications 8.3

Creates a page node type to test with, ensuring that it's moderated.

Parameters

string $entity_type: The entity type ID to enable workflow for.

string $bundle: The bundle ID.

Return value

\Drupal\Core\Entity\EntityInterface|\Drupal\workflows\Entity\Workflow The 'editorial' workflow.

2 calls to ContentModerationNotificationTestTrait::enableModeration()
NotificationsTest::setUp in tests/src/Kernel/NotificationsTest.php
TokenNotificationsTest::setUp in tests/src/Kernel/TokenNotificationsTest.php

File

tests/src/Kernel/ContentModerationNotificationTestTrait.php, line 26

Class

ContentModerationNotificationTestTrait
Helper functions for testing workflow participants.

Namespace

Drupal\Tests\content_moderation_notifications\Kernel

Code

protected function enableModeration($entity_type = 'entity_test_rev', $bundle = 'entity_test_rev') {

  // Check if workflow has already been created.
  if (!($workflow = Workflow::load('editorial'))) {
    $workflow = $this
      ->createEditorialWorkflow();
  }
  $workflow
    ->getTypePlugin()
    ->addEntityTypeAndBundle($entity_type, $bundle);
  $workflow
    ->save();
  return $workflow;
}