예제 #1
0
 public function testSpamSetController()
 {
     $model = new Kwf_Model_Mail(array('tpl' => 'UserActivation'));
     $row = $model->createRow();
     $row->addTo('*****@*****.**');
     $row->subject = 'Buy cheap viagra';
     $row->sent_mail_content_text = "cheap viagra cheap cialis buy now cheap viagra cheap cialis buy now\ncheap viagra cheap cialis buy now cheap viagra cheap cialis buy now";
     $row->save();
     $transport = $this->getMock('Zend_Mail_Transport_Abstract', array('_sendMail'));
     $transport->expects($this->never())->method('_sendMail');
     $ret = Kwf_Controller_Action_Spam_SetController::sendSpammedMail($row->id, 'xx' . Kwf_Util_Check_Spam::getSpamKey($row), $transport);
     $this->assertFalse($ret);
     $transport = $this->getMock('Zend_Mail_Transport_Abstract', array('_sendMail'));
     $transport->expects($this->never())->method('_sendMail');
     $ret = Kwf_Controller_Action_Spam_SetController::sendSpammedMail($row->id . '9999999999999999999', Kwf_Util_Check_Spam::getSpamKey($row), $transport);
     $this->assertFalse($ret);
     $transport = $this->getMock('Zend_Mail_Transport_Abstract', array('_sendMail'));
     $transport->expects($this->once())->method('_sendMail');
     $ret = Kwf_Controller_Action_Spam_SetController::sendSpammedMail($row->id, Kwf_Util_Check_Spam::getSpamKey($row), $transport);
     $this->assertTrue($ret);
     $transport = $this->getMock('Zend_Mail_Transport_Abstract', array('_sendMail'));
     $transport->expects($this->never())->method('_sendMail');
     $ret = Kwf_Controller_Action_Spam_SetController::sendSpammedMail($row->id, Kwf_Util_Check_Spam::getSpamKey($row), $transport);
     $this->assertFalse($ret);
 }
예제 #2
0
 public function testRow()
 {
     $model = new Kwf_Model_Mail(array('tpl' => 'UserActivation'));
     // normal
     $row = $model->getRow(4);
     $row->save_date = 'test';
     $this->assertEquals('test', $row->save_date);
     // im mail-vars sibling
     $row->blubb = 'bla';
     $this->assertEquals('bla', $row->blubb);
 }