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); }