/** * @test * @expectedException \TYPO3\Flow\Mvc\Exception\InfiniteLoopException */ public function dispatchThrowsAnInfiniteLoopExceptionIfTheRequestCouldNotBeDispachedAfter99Iterations() { $requestCallCounter = 0; $requestCallBack = function () use(&$requestCallCounter) { return $requestCallCounter++ < 101 ? FALSE : TRUE; }; $this->mockRequest->expects($this->any())->method('isDispatched')->will($this->returnCallBack($requestCallBack, '__invoke')); $this->dispatcher->dispatch($this->mockRequest, $this->mockResponse); }