transactionalEmailSettings = $this->getMockBuilder( Transactional::class )->disableOriginalConstructor( )->getMock(); $this->zendMailTransportSmtp1Factory = $this->getMockBuilder( ZendMailTransportSmtp1Factory::class )->disableOriginalConstructor( )->getMock(); $this->smtpTransportZend1 = new SmtpTransportZend1( $this->transactionalEmailSettings, $this->zendMailTransportSmtp1Factory ); } /** * @throws \Zend_Mail_Transport_Exception */ public function testSendUsesZend1MailTransportSmtp() { $message = new Zend_Mail(); $storeId = 124; $host = '127.0.0.1'; $transportConfig = []; $this->transactionalEmailSettings->expects($this->once()) ->method('getSmtpHost') ->with($storeId) ->willReturn($host); $this->transactionalEmailSettings->expects($this->once()) ->method('getTransportConfig') ->with($storeId) ->willReturn($transportConfig); $zendMailTransportSmtp = $this->getMockBuilder( Zend_Mail_Transport_Smtp::class )->disableOriginalConstructor( )->getMock(); $this->zendMailTransportSmtp1Factory->expects($this->once()) ->method('create') ->with($host, $transportConfig) ->willReturn($zendMailTransportSmtp); $zendMailTransportSmtp->expects($this->once()) ->method('send') ->with($message); $this->smtpTransportZend1->send($message, $storeId); } }