예제 #1
0
 /**
  * Run test execute method
  */
 public function testExecute()
 {
     $orderId = 1;
     $shipmentId = 1;
     $shipment = [];
     $tracking = [];
     $result = 'result-html';
     $layoutMock = $this->getMock('Magento\\Framework\\View\\Layout', ['createBlock'], [], '', false);
     $gridMock = $this->getMock('Magento\\Shipping\\Block\\Adminhtml\\Order\\Packaging\\Grid', ['setIndex', 'toHtml'], [], '', false);
     $this->requestMock->expects($this->at(0))->method('getParam')->with('order_id')->will($this->returnValue($orderId));
     $this->requestMock->expects($this->at(1))->method('getParam')->with('shipment_id')->will($this->returnValue($shipmentId));
     $this->requestMock->expects($this->at(2))->method('getParam')->with('shipment')->will($this->returnValue($shipment));
     $this->requestMock->expects($this->at(3))->method('getParam')->with('tracking')->will($this->returnValue($tracking));
     $this->shipmentLoaderMock->expects($this->once())->method('setOrderId')->with($orderId);
     $this->shipmentLoaderMock->expects($this->once())->method('setShipmentId')->with($shipmentId);
     $this->shipmentLoaderMock->expects($this->once())->method('setShipment')->with($shipment);
     $this->shipmentLoaderMock->expects($this->once())->method('setTracking')->with($tracking);
     $this->shipmentLoaderMock->expects($this->once())->method('load');
     $layoutMock->expects($this->once())->method('createBlock')->with('Magento\\Shipping\\Block\\Adminhtml\\Order\\Packaging\\Grid')->will($this->returnValue($gridMock));
     $this->viewMock->expects($this->once())->method('getLayout')->will($this->returnValue($layoutMock));
     $this->responseMock->expects($this->once())->method('setBody')->with($result)->will($this->returnSelf());
     $this->requestMock->expects($this->at(4))->method('getParam')->with('index');
     $gridMock->expects($this->once())->method('setIndex')->will($this->returnSelf());
     $gridMock->expects($this->once())->method('toHtml')->will($this->returnValue($result));
     $this->assertNotEmpty('result-html', $this->controller->execute());
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function dispatch(\Magento\Framework\App\RequestInterface $request)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'dispatch');
     if (!$pluginInfo) {
         return parent::dispatch($request);
     } else {
         return $this->___callPlugins('dispatch', func_get_args(), $pluginInfo);
     }
 }