public function testWithTemplate() { $user = $this->getMock('CM_Model_User', array('getEmail', 'getSite'), array(CMTest_TH::createUser()->getId())); $user->expects($this->any())->method('getEmail')->will($this->returnValue('*****@*****.**')); $user->expects($this->any())->method('getSite')->will($this->returnValue(CM_Site_Abstract::factory())); $templateVariabels = array('foo' => 'bar'); $msg = new CM_Mail_Welcome($user, $templateVariabels); list($subject, $html, $text) = $msg->render(); $this->assertNotEmpty($subject); $this->assertNotEmpty($html); $this->assertNotEmpty($text); }
public function testRenderTranslated() { $recipient = CMTest_TH::createUser(); $mail = new CM_Mail_Welcome($recipient); $language = CM_Model_Language::create('Test language', 'foo', true); $language->setTranslation('Welcome to {$siteName}!', 'foo'); list($subject, $html, $text) = $mail->render(); $nodeList = new CM_Dom_NodeList($html); $this->assertContains('foo', $nodeList->getText()); $nodeLink = $nodeList->find('a'); $this->assertSame(1, $nodeLink->count()); $this->assertSame('http://www.default.dev/example', $nodeLink->getAttribute('href')); $this->assertSame('Example Page', $nodeLink->getText()); $this->assertContains('border-style:solid;', $nodeLink->getAttribute('style')); }
public function testGetLabel() { $actor = CMTest_TH::createUser(); $typeEmail = CM_Mail_Welcome::getTypeStatic(); $action = new CM_Action_Email(CM_Action_Abstract::VIEW, $actor, $typeEmail); $this->assertSame('Email View Welcome', $action->getLabel()); }