本文整理汇总了PHP中EmailTemplate::getByType方法的典型用法代码示例。如果您正苦于以下问题:PHP EmailTemplate::getByType方法的具体用法?PHP EmailTemplate::getByType怎么用?PHP EmailTemplate::getByType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EmailTemplate
的用法示例。
在下文中一共展示了EmailTemplate::getByType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testListForWorkflowAction
/**
* @depends testListForMarketingAction
*/
public function testListForWorkflowAction()
{
$content = $this->runControllerWithNoExceptionsAndGetContent('emailTemplates/default/listForWorkflow');
$this->assertContains('Email Templates</title></head>', $content);
$this->assertContains('1 result', $content);
$this->assertEquals(substr_count($content, 'Test Name'), 1);
$this->assertEquals(substr_count($content, strval($this->user)), 2);
$this->assertEquals(substr_count($content, '<td>HTML</td>'), 1);
$emailTemplates = EmailTemplate::getByType(EmailTemplate::TYPE_WORKFLOW);
$this->assertEquals(1, count($emailTemplates));
}
示例2: getAvailableContactEmailTemplateNamesArray
protected function getAvailableContactEmailTemplateNamesArray()
{
$emailTemplates = EmailTemplate::getByType(EmailTemplate::TYPE_CONTACT);
$emailTemplatesArray = array();
foreach ($emailTemplates as $emailTemplate) {
$emailTemplatesArray[$emailTemplate->id] = $emailTemplate->name;
}
asort($emailTemplatesArray);
return $emailTemplatesArray;
}
示例3: testSuperUserListForWorkflowAction
/**
* @depends testSuperUserListForMarketingAction
*/
public function testSuperUserListForWorkflowAction()
{
$content = $this->runControllerWithNoExceptionsAndGetContent('emailTemplates/default/listForWorkflow');
$this->assertTrue(strpos($content, 'Email Templates</title></head>') !== false);
$this->assertTrue(strpos($content, '1 result') !== false);
$this->assertEquals(substr_count($content, 'Test Name'), 1);
$this->assertEquals(substr_count($content, 'Clark Kent'), 1);
$emailTemplates = EmailTemplate::getByType(EmailTemplate::TYPE_WORKFLOW);
$this->assertEquals(1, count($emailTemplates));
}
示例4: testGetByType
/**
* @depends testCreateAndGetEmailTemplateById
*/
public function testGetByType()
{
EmailTemplate::deleteAll();
// create 2 predefined non-builder templates for each type
EmailTemplateTestHelper::create('predefined 01', 'subject 01', null);
EmailTemplateTestHelper::create('predefined 02', 'subject 02', null);
EmailTemplateTestHelper::create('predefined 03', 'subject 03', null, 'html', 'text', EmailTemplate::TYPE_WORKFLOW);
EmailTemplateTestHelper::create('predefined 04', 'subject 04', null, 'html', 'text', EmailTemplate::TYPE_WORKFLOW);
// create 2 contact type, 1 draft 1 non draft
EmailTemplateTestHelper::create('contact 01', 'subject 01', 'Contact', 'html', 'text');
EmailTemplateTestHelper::create('contact 02', 'subject 02', 'Contact', 'html', 'text', EmailTemplate::TYPE_CONTACT, 1);
// create 2 workflow type, 1 draft 1 non draft
EmailTemplateTestHelper::create('workflow 01', 'subject 01', 'Note', 'html', 'text', EmailTemplate::TYPE_WORKFLOW);
EmailTemplateTestHelper::create('workflow 02', 'subject 02', 'Note', 'html', 'text', EmailTemplate::TYPE_WORKFLOW, 1);
// a- contact, exclude draft
$nonDraftContactTemplates = EmailTemplate::getByType(EmailTemplate::TYPE_CONTACT);
$this->assertCount(1, $nonDraftContactTemplates);
$this->assertEquals('contact 01', $nonDraftContactTemplates[0]->name);
// b- contact, include drafts
$nonDraftContactTemplates = EmailTemplate::getByType(EmailTemplate::TYPE_CONTACT, true);
$this->assertCount(2, $nonDraftContactTemplates);
$this->assertEquals('contact 01', $nonDraftContactTemplates[0]->name);
$this->assertEquals('contact 02', $nonDraftContactTemplates[1]->name);
// c- workflow, exclude draft
$nonDraftContactTemplates = EmailTemplate::getByType(EmailTemplate::TYPE_WORKFLOW);
$this->assertCount(1, $nonDraftContactTemplates);
$this->assertEquals('workflow 01', $nonDraftContactTemplates[0]->name);
// d- workflow, include drafts
$nonDraftContactTemplates = EmailTemplate::getByType(EmailTemplate::TYPE_WORKFLOW, true);
$this->assertCount(2, $nonDraftContactTemplates);
$this->assertEquals('workflow 01', $nonDraftContactTemplates[0]->name);
$this->assertEquals('workflow 02', $nonDraftContactTemplates[1]->name);
}