public function testTaskRetryCallbackIsInvoked() { $mock = $this->getMock('AndreasWeber\\Runner\\Test\\Stub\\TaskInvokedStub'); $mock->expects($this->once())->method('trigger')->willReturn(null); $task = new RetryMethodTaskStub(1); $task->setMaxRetries(new Retries(1)); $collection = new Collection(); $collection->addTask($task); $this->runner->setTaskCollection($collection); $this->runner->on('runner.task.retry', array($mock, 'trigger')); $this->runner->run($this->payload); }
/** * @expectedException \AndreasWeber\Runner\Runner\Exception\RunFailedException * @expectedExceptionMessage Max allowed retries exceeded. Allowed: 1. Tried: 2. */ public function testExceedingMaxRetriesFailsRun() { $task = new RetryMethodTaskStub(2); $task->setMaxRetries(new Retries(1)); $collection = new Collection(); $collection->addTask($task); $this->runner->setTaskCollection($collection); $this->runner->run($this->payload); }