Exemple #1
0
 public function testDetectsAMaximumTimeHasElapsed()
 {
     $this->time = 1000000000;
     $limit = new FixedTimeLimit(30, function () {
         return $this->time;
     });
     $limit->start();
     $this->assertFalse($limit->hasBeenReached(), "Limit should not be immediately reached");
     $this->time = 1000000029;
     $this->assertFalse($limit->hasBeenReached(), "Limit reached too soon");
     $this->time = 1000000030;
     $this->assertTrue($limit->hasBeenReached(), "Limit not reached yet");
 }
Exemple #2
0
 public function random(array $generators, callable $assertion)
 {
     $shrinker = new Random($generators, $assertion);
     if ($this->options['timeLimit'] !== null) {
         $shrinker->setTimeLimit(FixedTimeLimit::realTime($this->options['timeLimit']));
     }
     return $shrinker;
 }