当前位置: 首页>>代码示例>>PHP>>正文


PHP Swift_Transport_EsmtpTransport::setExtensionHandlers方法代码示例

本文整理汇总了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);
 }
开发者ID:collinsmarc,项目名称:AzureTest,代码行数:33,代码来源:ExtensionSupportTest.php


注:本文中的Swift_Transport_EsmtpTransport::setExtensionHandlers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。