protected function ContentModerationNotificationCreateTrait::createNotification in Content Moderation Notifications 8.3
Creates a content moderation notification entity with defaults.
Parameters
array $values: An array of values. Defaults are provided for any items not passed in.
Return value
\Drupal\content_moderation_notifications\ContentModerationNotificationInterface The saved entity.
2 calls to ContentModerationNotificationCreateTrait::createNotification()
- NotificationsTest::testEmailDelivery in tests/
src/ Kernel/ NotificationsTest.php - Test sending of emails.
- TokenNotificationsTest::testTokens in tests/
src/ Kernel/ TokenNotificationsTest.php - Test token functionality.
File
- tests/
src/ Kernel/ ContentModerationNotificationCreateTrait.php, line 21
Class
- ContentModerationNotificationCreateTrait
- Helper trait for creating notification entities.
Namespace
Drupal\Tests\content_moderation_notifications\KernelCode
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;
}