public function testExecute() { $orderId = 1; $invoiceId = 2; $invoiceData = []; $this->requestMock->expects($this->at(0))->method('getParam')->with('order_id')->will($this->returnValue($orderId)); $this->requestMock->expects($this->at(1))->method('getParam')->with('invoice_id')->will($this->returnValue($invoiceId)); $this->requestMock->expects($this->at(2))->method('getParam')->with('invoice', [])->will($this->returnValue($invoiceData)); $this->invoiceLoaderMock->expects($this->once())->method('load')->with($orderId, $invoiceId, $invoiceData); $this->assertNull($this->controller->execute()); }
public function testExecute() { $invoiceId = 2; $this->requestMock->expects($this->once())->method('getParam')->with('invoice_id')->will($this->returnValue($invoiceId)); $invoiceMock = $this->getMock('Magento\\Sales\\Model\\Order\\Invoice', [], [], '', false); $invoiceMock->expects($this->once())->method('load')->willReturnSelf(); $pdfMock = $this->getMock('Magento\\Sales\\Model\\Order\\Pdf\\Invoice', ['render', 'getPdf'], [], '', false); $pdfMock->expects($this->once())->method('getPdf')->willReturnSelf(); $pdfMock->expects($this->once())->method('render'); $dateTimeMock = $this->getMock('Magento\\Framework\\Stdlib\\DateTime\\DateTime', [], [], '', false); $this->objectManagerMock->expects($this->at(0))->method('create')->with('Magento\\Sales\\Model\\Order\\Invoice')->willReturn($invoiceMock); $this->objectManagerMock->expects($this->at(1))->method('create')->with('Magento\\Sales\\Model\\Order\\Pdf\\Invoice')->willReturn($pdfMock); $this->objectManagerMock->expects($this->at(2))->method('get')->with('Magento\\Framework\\Stdlib\\DateTime\\DateTime')->willReturn($dateTimeMock); $this->assertNull($this->controller->execute()); }