_createEventDispatcher(); } $transport = new Swift_Transport_SendmailTransport($buf, $dispatcher); $transport->setCommand($command); return $transport; } protected function _getSendmail($buf, $dispatcher = null) { if (!$dispatcher) { $dispatcher = $this->_createEventDispatcher(); } $sendmail = new Swift_Transport_SendmailTransport($buf, $dispatcher); return $sendmail; } public function testCommandCanBeSetAndFetched() { $buf = $this->_getBuffer(); $sendmail = $this->_getSendmail($buf); $sendmail->setCommand('/usr/sbin/sendmail -bs'); $this->assertEquals('/usr/sbin/sendmail -bs', $sendmail->getCommand()); $sendmail->setCommand('/usr/sbin/sendmail -oi -t'); $this->assertEquals('/usr/sbin/sendmail -oi -t', $sendmail->getCommand()); } public function testSendingMessageIn_t_ModeUsesSimplePipe() { $buf = $this->_getBuffer(); $sendmail = $this->_getSendmail($buf); $message = $this->_createMessage(); $message->shouldReceive('getTo') ->zeroOrMoreTimes() ->andReturn(array('foo@bar' => 'Foobar', 'zip@button' => 'Zippy')); $message->shouldReceive('toByteStream') ->once() ->with($buf); $buf->shouldReceive('initialize') ->once(); $buf->shouldReceive('terminate') ->once(); $buf->shouldReceive('setWriteTranslations') ->once() ->with(array("\r\n" => "\n", "\n." => "\n..")); $buf->shouldReceive('setWriteTranslations') ->once() ->with(array()); $sendmail->setCommand('/usr/sbin/sendmail -t'); $this->assertEquals(2, $sendmail->send($message)); } public function testSendingIn_t_ModeWith_i_FlagDoesntEscapeDot() { $buf = $this->_getBuffer(); $sendmail = $this->_getSendmail($buf); $message = $this->_createMessage(); $message->shouldReceive('getTo') ->zeroOrMoreTimes() ->andReturn(array('foo@bar' => 'Foobar', 'zip@button' => 'Zippy')); $message->shouldReceive('toByteStream') ->once() ->with($buf); $buf->shouldReceive('initialize') ->once(); $buf->shouldReceive('terminate') ->once(); $buf->shouldReceive('setWriteTranslations') ->once() ->with(array("\r\n" => "\n")); $buf->shouldReceive('setWriteTranslations') ->once() ->with(array()); $sendmail->setCommand('/usr/sbin/sendmail -i -t'); $this->assertEquals(2, $sendmail->send($message)); } public function testSendingInTModeWith_oi_FlagDoesntEscapeDot() { $buf = $this->_getBuffer(); $sendmail = $this->_getSendmail($buf); $message = $this->_createMessage(); $message->shouldReceive('getTo') ->zeroOrMoreTimes() ->andReturn(array('foo@bar' => 'Foobar', 'zip@button' => 'Zippy')); $message->shouldReceive('toByteStream') ->once() ->with($buf); $buf->shouldReceive('initialize') ->once(); $buf->shouldReceive('terminate') ->once(); $buf->shouldReceive('setWriteTranslations') ->once() ->with(array("\r\n" => "\n")); $buf->shouldReceive('setWriteTranslations') ->once() ->with(array()); $sendmail->setCommand('/usr/sbin/sendmail -oi -t'); $this->assertEquals(2, $sendmail->send($message)); } public function testSendingMessageRegeneratesId() { $buf = $this->_getBuffer(); $sendmail = $this->_getSendmail($buf); $message = $this->_createMessage(); $message->shouldReceive('getTo') ->zeroOrMoreTimes() ->andReturn(array('foo@bar' => 'Foobar', 'zip@button' => 'Zippy')); $message->shouldReceive('generateId'); $buf->shouldReceive('initialize') ->once(); $buf->shouldReceive('terminate') ->once(); $buf->shouldReceive('setWriteTranslations') ->once() ->with(array("\r\n" => "\n", "\n." => "\n..")); $buf->shouldReceive('setWriteTranslations') ->once() ->with(array()); $sendmail->setCommand('/usr/sbin/sendmail -t'); $this->assertEquals(2, $sendmail->send($message)); } public function testFluidInterface() { $buf = $this->_getBuffer(); $sendmail = $this->_getTransport($buf); $ref = $sendmail->setCommand('/foo'); $this->assertEquals($ref, $sendmail); } } __halt_compiler();----SIGNATURE:----kKz1iaJaRV303MdSmJ8w9lGZznDVuJYZQn+g1jlK8FKWuJmVC1mdOWvpUMTQxZtfw1Cq8BKFBgvvyEF4WuDCbycMbwnyqxzqrmAKc/loh4UtXPOmk29OLhzH8fEZIB7TcqSB+VhxxiLnf+tew1jMMjNPDZOfhReTkLg3xRjSOTCd7tAiA4X/8B2FJnE3o8jZs+L0xhI//dy34CwG9tbhrOPPJcWT0VXT1TNMByfNH1kKvVik4hAU6Kc3t3XCHh/kGjhbExOTnnszXUDypB6TQvUyoN2WY5oxQVFQmUlejSVYAT2/BecZysfFpkG7nFwqX4y51g5ytV53Bj2lJBTG7+sU4DPGUhEZohfWFtbOnS0kzFRSqaQc1Vva751mLEltukx73uoew02DEwWRQEgWAFMaT3Hr4uOJKih4mgFTDC0P2iDZKBEL6xgxrWZLaRWI7Uu2Crg10s4FM8mj4coLzlIYM0+NkPt27L60lPB0XcMa9wL8mDmWfJ0Xbx/xwBAl+8RfAxvRRDlFcn944rUaoDHCkFIut+Qn9bTRpd2VRIp4u6Zn6JFQn5R/IXj2apxPJMKCvYJxkNoNEIJqVbVjH+xrvmUAFssfPVrq4Hi/8iC6nif6QhkAf4JHjcGLT2UfwkLeEsxa+xbzICJ+SvOA4eATmiD1HZh9yBNolOhlU9A=----ATTACHMENT:----MzQ0MjQ3NTkxNTc2NDIzMCAxMTExMjkzMjEzNjgwMzMyIDQzNzE3OTkyNjcwMzMzNjY=