public function CourierGlobalCollectionInvalidTemplateTest::testInvalidTemplate in Courier 8
Same name and namespace in other branches
- 2.x tests/src/Kernel/CourierGlobalCollectionInvalidTemplateTest.php \Drupal\Tests\courier\Kernel\CourierGlobalCollectionInvalidTemplateTest::testInvalidTemplate()
Test that a non-existent template type does not cause problems creating a new template collection.
File
- tests/
src/ Kernel/ CourierGlobalCollectionInvalidTemplateTest.php, line 41
Class
- CourierGlobalCollectionInvalidTemplateTest
- Tests Courier global template collections with invalid template types.
Namespace
Drupal\Tests\courier\KernelCode
public function testInvalidTemplate() {
$gtc = GlobalTemplateCollection::create([
'id' => 'foobar',
])
->setTemplate('courier_email', [
'subject' => 'MySubject22',
'body' => 'MyBody432423',
])
->setTemplate($this
->randomMachineName(), []);
$gtc
->save();
$tc = $this->gtcService
->getLocalCollection($gtc);
$this
->assertTrue($tc instanceof TemplateCollectionInterface);
$this
->assertEquals(1, count($tc
->getTemplates()));
}