public function CourierGlobalCollectionTest::testTemplateUpdatesGlobalTemplateCollection in Courier 8
Same name and namespace in other branches
- 2.x tests/src/Kernel/CourierGlobalCollectionTest.php \Drupal\Tests\courier\Kernel\CourierGlobalCollectionTest::testTemplateUpdatesGlobalTemplateCollection()
Ensure individual template update saves to global template collection.
File
- tests/
src/ Kernel/ CourierGlobalCollectionTest.php, line 95
Class
- CourierGlobalCollectionTest
- Tests Courier global template collections interaction with local templates.
Namespace
Drupal\Tests\courier\KernelCode
public function testTemplateUpdatesGlobalTemplateCollection() {
$old_message = $this
->randomString();
$gtc = GlobalTemplateCollection::create([
'id' => $this
->randomMachineName(),
])
->setTemplate('courier_test_message', [
'message' => $old_message,
]);
$gtc
->save();
// Instantiate template collection
$tc = $this->gtcService
->getLocalCollection($gtc);
$template_id = $tc
->getTemplate('courier_test_message')
->id();
$new_message = $this
->randomString();
TestMessage::load($template_id)
->setMessage($new_message)
->save();
// Reload global template collection.
$gtc = GlobalTemplateCollection::load($gtc
->id());
$this
->assertEquals($new_message, $gtc
->getTemplate('courier_test_message')['message']);
}