markTestSkipped( 'mail() function not available.' ); } $this->transport = new ezcMailMtaTransport(); $this->mail = new ezcMail(); $this->mail->from = new ezcMailAddress( 'nospam@ez.no', 'Unit testing' ); $this->mail->addTo( new ezcMailAddress( 'nospam@ez.no', 'Foster' ) ); $this->mail->subject = "[Components test] Mta test"; $this->mail->body = new ezcMailText( "It doesn't look as if it's ever used." ); } // Tests sending a complete mail message. public function testFullMail() { try { $this->transport->send( $this->mail ); } catch ( ezcMailTransportException $e ) { $this->fail( $e->getMessage() ); } } // Tests sending several complete mail messages. public function testFullMailMultiple() { try { $this->transport->send( $this->mail ); $this->transport->send( $this->mail ); } catch ( ezcMailTransportException $e ) { $this->fail( $e->getMessage() ); } } // Tests sending a mail with empty to field. public function testInvalidMail1() { $this->mail->to = array(); $this->mail->subject = "No recepients"; try { $this->transport->send( $this->mail ); } catch ( ezcMailTransportException $e ) { return; } $this->fail( 'MTA send without recipients did not fail.' ); } // Tests sending a mail with null to field. public function testInvalidMail2() { $this->mail->to = null; $this->mail->subject = "No recepients"; try { $this->transport->send( $this->mail ); } catch ( ezcMailTransportException $e ) { return; } $this->fail( 'MTA send without recipients did not fail.' ); } // Tests sending a complete mail message with Return-Path set. public function testFullMailReturnPath() { $this->mail->returnPath = new ezcMailAddress( 'returnpath@ez.no' ); try { $this->transport->send( $this->mail ); } catch ( ezcMailTransportException $e ) { $this->fail( $e->getMessage() ); } } public static function suite() { return new PHPUnit_Framework_TestSuite( "ezcMailTransportMtaTest" ); } } ?>