예제 #1
0
 public function testSend_valid()
 {
     $transport = $this->getMock('r8\\Mail\\Transport', array('internalSend'));
     $mail = new \r8\Mail($transport);
     $mail->setFrom('*****@*****.**');
     $mail->addTo('*****@*****.**');
     $transport->expects($this->once())->method('internalSend')->with($this->equalTo($mail));
     $this->assertSame($transport, $transport->send($mail));
 }
예제 #2
0
파일: Mail.php 프로젝트: Nycto/Round-Eights
 public function testSend_fail()
 {
     $format = $this->getMock('\\r8\\Mail\\Formatter');
     $transport = $this->getMock('r8\\Mail\\Transport\\Mail', array('rawMail'), array($format));
     $transport->expects($this->once())->method("rawMail")->with($this->equalTo('"Destination" <*****@*****.**>'), $this->equalTo("Some Test Email"), $this->equalTo("This is the text"), $this->equalTo('From: "Test Acct" <*****@*****.**>'))->will($this->returnValue(FALSE));
     $mail = new \r8\Mail($transport);
     $mail->setFrom("*****@*****.**", "Test Acct")->addTo("*****@*****.**", "Destination")->setSubject("Some Test Email")->setText("This is the text");
     $format->expects($this->exactly(2))->method("getToString")->with($this->equalTo($mail))->will($this->returnValue('"Destination" <*****@*****.**>'));
     $format->expects($this->once())->method("getBody")->with($this->equalTo($mail))->will($this->returnValue('This is the text'));
     $format->expects($this->once())->method("getHeaderString")->with($this->equalTo($mail))->will($this->returnValue('From: "Test Acct" <*****@*****.**>'));
     try {
         $transport->send($mail);
         $this->fail("An expected exception was not thrown");
     } catch (\r8\Exception\Interaction $err) {
         $this->assertSame("An error occured while sending mail", $err->getMessage());
     }
 }
예제 #3
0
파일: Mail.php 프로젝트: Nycto/Round-Eights
 public function testSend()
 {
     $transport = $this->getMock('r8\\Mail\\Transport', array('internalSend', 'send'));
     $mail = new \r8\Mail($this->getTestTransport());
     $mail->setTransport($transport);
     $transport->expects($this->once())->method('send')->with($this->equalTo($mail));
     $this->assertSame($mail, $mail->send());
 }