本文整理匯總了PHP中Swift_Transport_EsmtpTransport::setExtensionHandlers方法的典型用法代碼示例。如果您正苦於以下問題:PHP Swift_Transport_EsmtpTransport::setExtensionHandlers方法的具體用法?PHP Swift_Transport_EsmtpTransport::setExtensionHandlers怎麽用?PHP Swift_Transport_EsmtpTransport::setExtensionHandlers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Swift_Transport_EsmtpTransport
的用法示例。
在下文中一共展示了Swift_Transport_EsmtpTransport::setExtensionHandlers方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testExtensionsCanModifyRcptParams
public function testExtensionsCanModifyRcptParams()
{
$buf = $this->_getBuffer();
$dispatcher = $this->_createEventDispatcher();
$smtp = new Swift_Transport_EsmtpTransport($buf, array(), $dispatcher);
$ext1 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
$ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
$ext3 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
$message = $this->_createMessage();
$message->shouldReceive('getFrom')->zeroOrMoreTimes()->andReturn(array('me@domain' => 'Me'));
$message->shouldReceive('getTo')->zeroOrMoreTimes()->andReturn(array('foo@bar' => null));
$buf->shouldReceive('readLine')->once()->with(0)->andReturn("220 server.com foo\r\n");
$buf->shouldReceive('write')->once()->with('~^EHLO .+?\\r\\n$~D')->andReturn(1);
$buf->shouldReceive('readLine')->once()->with(1)->andReturn("250-ServerName.tld\r\n");
$buf->shouldReceive('readLine')->once()->with(1)->andReturn("250-AUTH PLAIN LOGIN\r\n");
$buf->shouldReceive('readLine')->once()->with(1)->andReturn("250 SIZE=123456\r\n");
$buf->shouldReceive('write')->once()->with("MAIL FROM:<me@domain>\r\n")->andReturn(2);
$buf->shouldReceive('readLine')->once()->with(2)->andReturn("250 OK\r\n");
$buf->shouldReceive('write')->once()->with("RCPT TO:<foo@bar> FOO ZIP\r\n")->andReturn(3);
$buf->shouldReceive('readLine')->once()->with(3)->andReturn("250 OK\r\n");
$this->_finishBuffer($buf);
$ext1->shouldReceive('getHandledKeyword')->zeroOrMoreTimes()->andReturn('AUTH');
$ext1->shouldReceive('getRcptParams')->once()->andReturn('FOO');
$ext1->shouldReceive('getPriorityOver')->zeroOrMoreTimes()->with('AUTH')->andReturn(-1);
$ext2->shouldReceive('getHandledKeyword')->zeroOrMoreTimes()->andReturn('SIZE');
$ext2->shouldReceive('getRcptParams')->once()->andReturn('ZIP');
$ext2->shouldReceive('getPriorityOver')->zeroOrMoreTimes()->with('AUTH')->andReturn(1);
$ext3->shouldReceive('getHandledKeyword')->zeroOrMoreTimes()->andReturn('STARTTLS');
$ext3->shouldReceive('getRcptParams')->never();
$smtp->setExtensionHandlers(array($ext1, $ext2, $ext3));
$smtp->start();
$smtp->send($message);
}