/** * @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->executeInternal(); }