public function testMultiBackOff()
 {
     $min = $this->policy->getMinBackOffPeriod();
     $max = $this->policy->getMaxBackOffPeriod();
     for ($x = 0; $x < 5; $x++) {
         $this->backOff();
         $this->assertEquals($this->randomize($min, $max), $this->sleeper->getLastBackOff());
     }
 }
 public function testManyBackOffCalls()
 {
     $this->policy->setBackOffPeriod(50);
     $this->policy->start();
     for ($x = 0; $x < 10; $x++) {
         $this->policy->backOff();
         $this->assertEquals(50, $this->sleeper->getLastBackOff());
     }
     $this->assertEquals(10, count($this->sleeper->getBackOffs()));
 }
 public function testMultiBackOff()
 {
     $seed = 100;
     $delta = 10;
     $this->policy->setInitialInterval($seed);
     $this->policy->setDeltaInterval($delta);
     $context = $this->policy->start();
     for ($x = 0; $x < 5; $x++) {
         $this->policy->backOff($context);
         $this->assertEquals($seed, $this->sleeper->getLastBackOff());
         $seed += $delta;
     }
 }
 public function testMultiBackOff()
 {
     $seed = 40;
     $multiplier = 1.2;
     $this->policy->setInitialInterval($seed);
     $this->policy->setMultiplier($multiplier);
     $context = $this->policy->start();
     for ($x = 0; $x < 5; $x++) {
         $this->backOff($context);
         $this->assertEquals($this->randomize($seed, $multiplier), $this->sleeper->getLastBackOff());
         $seed *= $multiplier;
     }
 }