/**
  * Test if first job delay can be different than failed attempts.
  */
 public function testFirstAttemptCanHaveDifferentDelayThanFailedAttempts()
 {
     $this->assertRecordsCount(0);
     // Set delay of two seconds, because we sometimes got nextInLine() when job was set in one second, and we got to
     // the next second during assertRecordsCount() step
     $failing_job_with_instant_first_attempt = new Failing(['delay' => 2, 'attempts' => 2, 'first_attempt_delay' => 0]);
     $this->assertEquals(0, $failing_job_with_instant_first_attempt->getFirstJobDelay());
     $this->assertEquals(2, $failing_job_with_instant_first_attempt->getDelay());
     // Enqueue
     $this->assertEquals(1, $this->dispatcher->dispatch($failing_job_with_instant_first_attempt));
     $this->assertRecordsCount(1);
     // First attempt
     $next_in_line = $this->dispatcher->getQueue()->nextInLine();
     $this->assertInstanceOf('ActiveCollab\\JobsQueue\\Test\\Jobs\\Failing', $next_in_line);
     $this->assertEquals(1, $next_in_line->getQueueId());
     $this->dispatcher->getQueue()->execute($next_in_line);
     // Second attempt
     $this->assertRecordsCount(1);
     $this->assertAttempts(1, $next_in_line->getQueueId());
     $this->assertNull($this->dispatcher->getQueue()->nextInLine());
     // Not yet available
     sleep(2);
     $next_in_line = $this->dispatcher->getQueue()->nextInLine();
     $this->assertInstanceOf('ActiveCollab\\JobsQueue\\Test\\Jobs\\Failing', $next_in_line);
     $this->assertEquals(1, $next_in_line->getQueueId());
     $this->dispatcher->getQueue()->execute($next_in_line);
     $this->assertRecordsCount(0);
 }