本文整理汇总了PHP中EmailTemplate::getCount方法的典型用法代码示例。如果您正苦于以下问题:PHP EmailTemplate::getCount方法的具体用法?PHP EmailTemplate::getCount怎么用?PHP EmailTemplate::getCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EmailTemplate
的用法示例。
在下文中一共展示了EmailTemplate::getCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDeleteAction
/**
* @depends testDetailsActionForMarketing
* @depends testDetailsActionForWorkflow
*/
public function testDeleteAction()
{
$initialCount = EmailTemplate::getCount();
$emailTemplateId = self::getModelIdByModelNameAndName('EmailTemplate', 'marketing 01');
// Delete an emailTemplate.
$this->setGetArray(array('id' => $emailTemplateId));
$this->resetPostArray();
$redirectUrl = $this->runControllerWithRedirectExceptionAndGetUrl('emailTemplates/default/delete');
$compareRedirectUrl = Yii::app()->createUrl('emailTemplates/default/listForMarketing');
$this->assertEquals($compareRedirectUrl, $redirectUrl);
$this->assertEquals($initialCount - 1, EmailTemplate::getCount());
$emailTemplateId = self::getModelIdByModelNameAndName('EmailTemplate', 'workflow 01');
$this->setGetArray(array('id' => $emailTemplateId));
$this->resetPostArray();
$redirectUrl = $this->runControllerWithRedirectExceptionAndGetUrl('emailTemplates/default/delete');
$compareRedirectUrl = Yii::app()->createUrl('emailTemplates/default/listForWorkflow');
$this->assertEquals($compareRedirectUrl, $redirectUrl);
$this->assertEquals($initialCount - 2, EmailTemplate::getCount());
}
示例2: testDummyHtmlContentThrowsValidationErrorWhenTextContentIsEmpty
/**
* @depends testCreateAndGetEmailTemplateById
*/
public function testDummyHtmlContentThrowsValidationErrorWhenTextContentIsEmpty()
{
$emailTemplate = new EmailTemplate();
$emailTemplate->type = EmailTemplate::TYPE_CONTACT;
$emailTemplate->builtType = EmailTemplate::BUILT_TYPE_PASTED_HTML;
$emailTemplate->subject = 'Another Test subject';
$emailTemplate->name = 'Another Test Email Template';
$emailTemplate->textContent = '';
$emailTemplate->htmlContent = "<html>\n<head>\n</head>\n<body>\n</body>\n</html>";
$emailTemplate->modelClassName = 'Contact';
$validated = $emailTemplate->validate(null, false, true);
$this->assertFalse($validated);
$errorMessages = $emailTemplate->getErrors();
$this->assertEquals(1, count($errorMessages));
$this->assertTrue(array_key_exists('textContent', $errorMessages));
$this->assertEquals(1, count($errorMessages['textContent']));
$this->assertEquals('Please provide at least one of the contents field.', $errorMessages['textContent'][0]);
$emailTemplate->textContent = 'Text Content';
$validated = $emailTemplate->validate(null, false, true);
$this->assertTrue($validated);
$this->assertTrue($emailTemplate->save());
$this->assertEquals(6, EmailTemplate::getCount());
$id = $emailTemplate->id;
unset($emailTemplate);
$emailTemplate = EmailTemplate::getById($id);
$this->assertEquals(EmailTemplate::TYPE_CONTACT, $emailTemplate->type);
$this->assertEquals('Another Test subject', $emailTemplate->subject);
$this->assertEquals('Another Test Email Template', $emailTemplate->name);
$this->assertEquals(null, $emailTemplate->htmlContent);
$this->assertEquals('Text Content', $emailTemplate->textContent);
}