/** * {@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); } }
/** * @param $errorMsg * @param $errorMsgEscaped * @dataProvider checkXSSEscapedDataProvider */ public function testCheckXSSEscaped($errorMsg, $errorMsgEscaped) { $this->initLayoutMock(); $this->initOrderMock(self::LAST_REAL_ORDER_ID, Order::STATE_NEW); $this->initCheckoutSessionMock(self::LAST_REAL_ORDER_ID, true); $this->requestMock->expects($this->once())->method('getParam')->with('RESPMSG')->will($this->returnValue($errorMsg)); $this->helperCheckoutMock->expects($this->once())->method('cancelCurrentOrder')->with($errorMsgEscaped)->will($this->returnValue(self::LAST_REAL_ORDER_ID)); $this->blockMock->expects($this->at(0))->method('setData')->with('goto_section', 'paymentMethod')->will($this->returnSelf()); $this->blockMock->expects($this->at(1))->method('setData')->with('error_msg', __('Your payment has been declined. Please try again.'))->will($this->returnSelf()); $this->paymentMock->expects($this->once())->method('getMethod')->will($this->returnValue(Config::METHOD_PAYFLOWLINK)); $this->returnUrl->execute(); }
/** * @param $state * @param $restoreQuote * @param $expectedGotoSection * @dataProvider testNotAllowedOrderStateDataProvider */ public function testExecuteNotAllowedOrderState($state, $restoreQuote, $expectedGotoSection) { $lastRealOrderId = '000000001'; $this->viewMock->expects($this->once())->method('getLayout')->will($this->returnValue($this->layoutMock)); $this->layoutMock->expects($this->once())->method('getBlock')->will($this->returnValue($this->blockMock)); $this->checkoutSessionMock->expects($this->any())->method('getLastRealOrderId')->will($this->returnValue($lastRealOrderId)); $this->checkoutSessionMock->expects($this->any())->method('getLastRealOrder')->will($this->returnValue($this->orderMock)); $this->checkoutSessionMock->expects($this->any())->method('restoreQuote')->will($this->returnValue($restoreQuote)); $this->orderFactoryMock->expects($this->any())->method('create')->will($this->returnValue($this->orderMock)); $this->orderMock->expects($this->once())->method('loadByIncrementId')->with($lastRealOrderId)->will($this->returnSelf()); $this->orderMock->expects($this->once())->method('getIncrementId')->will($this->returnValue($lastRealOrderId)); $this->orderMock->expects($this->once())->method('getState')->will($this->returnValue($state)); $this->blockMock->expects($this->at(0))->method('setData')->with('goto_section', $expectedGotoSection)->will($this->returnSelf()); $this->blockMock->expects($this->at(1))->method('setData')->with('error_msg', __('Your payment has been declined. Please try again.'))->will($this->returnSelf()); $this->returnUrl->execute(); }