trait ContentModerationNotificationTestTrait in Content Moderation Notifications 8.3
Helper functions for testing workflow participants.
Hierarchy
- trait \Drupal\Tests\content_moderation_notifications\Kernel\ContentModerationNotificationTestTrait uses ContentModerationTestTrait
1 file declares its use of ContentModerationNotificationTestTrait
- CrudFormTest.php in tests/
src/ Functional/ Form/ CrudFormTest.php
File
- tests/
src/ Kernel/ ContentModerationNotificationTestTrait.php, line 11
Namespace
Drupal\Tests\content_moderation_notifications\KernelView source
trait ContentModerationNotificationTestTrait {
use ContentModerationTestTrait;
/**
* Creates a page node type to test with, ensuring that it's moderated.
*
* @param string $entity_type
* The entity type ID to enable workflow for.
* @param string $bundle
* The bundle ID.
*
* @return \Drupal\Core\Entity\EntityInterface|\Drupal\workflows\Entity\Workflow
* The 'editorial' workflow.
*/
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;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContentModerationNotificationTestTrait:: |
protected | function | Creates a page node type to test with, ensuring that it's moderated. | |
ContentModerationTestTrait:: |
protected | function | Adds an entity type ID / bundle ID to the given workflow. | 1 |
ContentModerationTestTrait:: |
protected | function | Creates the editorial workflow. | 1 |