transactionalEmailSettings = $this->getMockBuilder( Transactional::class )->disableOriginalConstructor( )->getMock(); $this->zendMailTransportSmtp2Factory = $this->getMockBuilder( ZendMailTransportSmtp2Factory::class )->disableOriginalConstructor( )->getMock(); $this->smtpTransportZend2 = new SmtpTransportZend2( $this->transactionalEmailSettings, $this->zendMailTransportSmtp2Factory ); } /** */ public function testSendUsesZend2MailTransportSmtp() { $message = new Message(); $storeId = 224; $smtpOptions = []; $this->transactionalEmailSettings->expects($this->once()) ->method('getSmtpOptions') ->with($storeId) ->willReturn($smtpOptions); $zendMail2TransportSmtp = $this->getMockBuilder( Smtp::class )->disableOriginalConstructor( )->getMock(); $this->zendMailTransportSmtp2Factory->expects($this->once()) ->method('create') ->with($smtpOptions) ->willReturn($zendMail2TransportSmtp); $zendMail2TransportSmtp->expects($this->once()) ->method('send') ->with($message); $this->smtpTransportZend2->send($message, $storeId); } }