_messageMock = $this->getMock('\Magento\Framework\Mail\Message', [], [], '', false); $this->_transport = new \Magento\Framework\Mail\Transport($this->_messageMock); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage The message should be an instance of \Zend_Mail */ public function testTransportWithIncorrectMessageObject() { $this->_messageMock = $this->getMock('\Magento\Framework\Mail\MessageInterface'); $this->_transport = new \Magento\Framework\Mail\Transport($this->_messageMock); } /** * @covers \Magento\Framework\Mail\Transport::sendMessage * @expectedException \Magento\Framework\Exception\MailException * @expectedExceptionMessage No body specified */ public function testSendMessageBrokenMessage() { $this->_messageMock->expects($this->any()) ->method('getParts') ->will($this->returnValue(['a', 'b'])); $this->_transport->sendMessage(); } }