/** * @test */ public function shouldNotThrowIfNumberOfPreviousRequestNotReachLimit() { $gatewayMock = $this->createGatewayMock(); $context = new Context($gatewayMock, new \stdClass(), array(new Context($gatewayMock, new \stdClass(), array()), new Context($gatewayMock, new \stdClass(), array()), new Context($gatewayMock, new \stdClass(), array()))); $extension = new EndlessCycleDetectorExtension($expectedLimit = 5); $extension->onPreExecute($context); }
/** * @test * * @expectedException \Payum\Core\Exception\LogicException * @expectedExceptionMessage Possible endless cycle detected. ::onPreExecute was called 2 times before reach the limit. */ public function throwIfCycleCounterReachLimit() { $extension = new EndlessCycleDetectorExtension($expectedLimit = 2); $extension->onPreExecute(new \stdClass()); $extension->onPreExecute(new \stdClass()); $extension->onPreExecute(new \stdClass()); }