Exemple #1
0
 public function testExecuteNoInvoice()
 {
     $invoiceId = 2;
     $this->requestMock->expects($this->once())->method('getParam')->with('invoice_id')->will($this->returnValue($invoiceId));
     $this->invoiceRepository->expects($this->once())->method('get')->willReturn(null);
     $resultForward = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\Forward')->disableOriginalConstructor()->setMethods([])->getMock();
     $resultForward->expects($this->once())->method('forward')->with('noroute')->will($this->returnSelf());
     $this->resultForwardFactoryMock->expects($this->once())->method('create')->will($this->returnValue($resultForward));
     $this->assertSame($resultForward, $this->controller->execute());
 }
Exemple #2
0
 public function testExecuteNoInvoice()
 {
     $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)->will($this->returnValue(false));
     $this->assertNull($this->controller->execute());
 }