mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-27 07:44:29 +02:00
Ivan - Add Unit testing for MailTemplate [skip ci]
This commit is contained in:
parent
8b810f7bd5
commit
e6fb52791e
27
server/tests/models/MailTemplateTest.php
Normal file
27
server/tests/models/MailTemplateTest.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
include_once 'tests/__lib__/Mock.php';
|
||||
include_once 'models/MailTemplate.php';
|
||||
|
||||
class MailTemplateTest extends PHPUnit_Framework_TestCase {
|
||||
public function testGetTemplateShouldReturnSpecifiedTemplate() {
|
||||
$mailTemplate = MailTemplate::getTemplate(MailTemplate::USER_SIGNUP);
|
||||
|
||||
$this->assertEquals(MailTemplate::USER_SIGNUP, $mailTemplate->type);
|
||||
}
|
||||
|
||||
public function testCompilation() {
|
||||
$mailTemplate = new MailTemplate();
|
||||
$mailTemplate->setProperties([
|
||||
'subject' => 'Welcoming to {{to}}',
|
||||
'body' => 'Welcome, {{userName}} to our team'
|
||||
]);
|
||||
|
||||
$result = $mailTemplate->compile([
|
||||
'to' => 'cersei@opensupports.com',
|
||||
'userName' => 'Cersei Lannister',
|
||||
]);
|
||||
|
||||
$this->assertEquals($result['subject'], 'Welcoming to cersei@opensupports.com');
|
||||
$this->assertEquals($result['body'], 'Welcome, Cersei Lannister to our team');
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user