You are here

protected function CourierSystemTest::createGlobalTemplateCollection in Courier 2.x

Same name and namespace in other branches
  1. 8 courier_system/tests/src/Kernel/CourierSystemTest.php \Drupal\Tests\courier_system\Kernel\CourierSystemTest::createGlobalTemplateCollection()

Create a global template collection and change its email body.

Parameters

int $id: The ID for the new global template collection.

string $email_body: Change the email template body.

Return value

\Drupal\courier\Entity\GlobalTemplateCollectionInterface

2 calls to CourierSystemTest::createGlobalTemplateCollection()
CourierSystemTest::testNonOverride in courier_system/tests/src/Kernel/CourierSystemTest.php
Test courier system override is off.
CourierSystemTest::testOverride in courier_system/tests/src/Kernel/CourierSystemTest.php
Test courier system override is on.

File

courier_system/tests/src/Kernel/CourierSystemTest.php, line 153

Class

CourierSystemTest
Tests Courier system.

Namespace

Drupal\Tests\courier_system\Kernel

Code

protected function createGlobalTemplateCollection($id, $email_body) {
  $gtc = GlobalTemplateCollection::create([
    'id' => $id,
  ]);
  $gtc
    ->save();
  $gtc
    ->getTemplateCollection()
    ->getTemplate('courier_email')
    ->setSubject($this
    ->randomMachineName())
    ->setBody($email_body)
    ->save();
  return $gtc;
}