ContentModerationNotificationCreateTrait.php in Content Moderation Notifications 8.3
File
tests/src/Kernel/ContentModerationNotificationCreateTrait.php
View source
<?php
namespace Drupal\Tests\content_moderation_notifications\Kernel;
use Drupal\content_moderation_notifications\Entity\ContentModerationNotification;
trait ContentModerationNotificationCreateTrait {
protected function createNotification(array $values = []) {
$values += [
'id' => mb_strtolower($this
->randomMachineName()),
'workflow' => 'editorial',
'subject' => $this
->randomString(),
'status' => 1,
'body' => [
'value' => $this->randomGenerator
->paragraphs(2),
'format' => 'filtered_html',
],
'roles' => [],
'emails' => '',
'transitions' => [],
];
$notification = ContentModerationNotification::create($values);
$notification
->save();
return $notification;
}
}