示例#1
0
 public function testQueue()
 {
     $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()));
     $msg = new CM_Mail($user, null);
     $msg->setSubject('testSubject');
     $msg->setHtml('<b>hallo</b>');
     $msg->addReplyTo('*****@*****.**');
     $msg->addCc('*****@*****.**', 'foobar');
     $msg->addBcc('*****@*****.**');
     $msg->sendDelayed();
     $this->assertRow('cm_mail', array('subject' => 'testSubject', 'text' => 'hallo', 'html' => '<b>hallo</b>', 'to' => serialize($msg->getTo()), 'replyTo' => serialize($msg->getReplyTo()), 'cc' => serialize($msg->getCc()), 'bcc' => serialize($msg->getBcc())));
     $this->assertEquals(1, CM_Db_Db::count('cm_mail', 'id'));
     CM_Mail::processQueue(1);
     $this->assertEquals(0, CM_Db_Db::count('cm_mail', 'id'));
 }
示例#2
0
 /**
  * @param CM_Mail $mail
  * @param string  $msg
  */
 public function addMail(CM_Mail $mail, $msg)
 {
     $this->_add($msg, array('sender' => $mail->getSender(), 'replyTo' => $mail->getReplyTo(), 'to' => $mail->getTo(), 'cc' => $mail->getCc(), 'bcc' => $mail->getBcc()));
 }