/** * @test */ public function dispatchContinuesWithNextRequestFoundInAForwardException() { /** @var ActionRequest|\PHPUnit_Framework_MockObject_MockObject $nextRequest */ $nextRequest = $this->getMockBuilder(\TYPO3\Flow\Mvc\ActionRequest::class)->disableOriginalConstructor()->getMock(); $nextRequest->expects($this->atLeastOnce())->method('isDispatched')->will($this->returnValue(TRUE)); $this->mockParentRequest->expects($this->atLeastOnce())->method('isDispatched')->will($this->returnValue(FALSE)); $this->mockController->expects($this->at(0))->method('processRequest')->with($this->mockActionRequest)->will($this->throwException(new StopActionException())); $forwardException = new ForwardException(); $forwardException->setNextRequest($nextRequest); $this->mockController->expects($this->at(1))->method('processRequest')->with($this->mockParentRequest)->will($this->throwException($forwardException)); $this->dispatcher->dispatch($this->mockActionRequest, $this->mockHttpResponse); }
/** * @test */ public function dispatchContinuesWithNextRequestFoundInAForwardException() { $subRequest = $this->getMockBuilder('TYPO3\\Flow\\Mvc\\ActionRequest')->disableOriginalConstructor()->getMock(); $subRequest->expects($this->atLeastOnce())->method('isMainRequest')->will($this->returnValue(FALSE)); $subRequest->expects($this->atLeastOnce())->method('getParentRequest')->will($this->returnValue($this->mockRequest)); $subRequest->expects($this->atLeastOnce())->method('isDispatched')->will($this->returnValue(FALSE)); $nextRequest = $this->getMockBuilder('TYPO3\\Flow\\Mvc\\ActionRequest')->disableOriginalConstructor()->getMock(); $nextRequest->expects($this->atLeastOnce())->method('isDispatched')->will($this->returnValue(TRUE)); $this->mockRequest->expects($this->atLeastOnce())->method('isDispatched')->will($this->returnValue(FALSE)); $this->mockController->expects($this->at(0))->method('processRequest')->with($subRequest)->will($this->throwException(new \TYPO3\Flow\Mvc\Exception\StopActionException())); $forwardException = new ForwardException(); $forwardException->setNextRequest($nextRequest); $this->mockController->expects($this->at(1))->method('processRequest')->with($this->mockRequest)->will($this->throwException($forwardException)); $this->dispatcher->dispatch($subRequest, $this->mockResponse); }