Eris\Quantifier\Evaluation::of PHP Method

of() public static method

public static of ( $assertion )
    public static function of($assertion)
    {
        return new self($assertion);
    }

Usage Example

Beispiel #1
0
 /**
  * Precondition: $values should fail $this->assertion
  */
 public function from(array $elements, AssertionFailed $exception)
 {
     $onBadShrink = function () use(&$exception) {
         $this->attempts->increase();
         $this->attempts->ensureLimit($exception);
     };
     $onGoodShrink = function ($elementsAfterShrink, $exceptionAfterShrink) use(&$elements, &$exception) {
         $this->attempts->reset();
         $elements = $elementsAfterShrink;
         $exception = $exceptionAfterShrink;
     };
     $this->timeLimit->start();
     while (!$this->timeLimit->hasBeenReached()) {
         $elementsAfterShrink = $this->generator->shrink($elements);
         if ($elementsAfterShrink === $elements) {
             $onBadShrink();
             continue;
         }
         if (!$this->checkGoodShrinkConditions($elementsAfterShrink)) {
             $onBadShrink();
             continue;
         }
         Evaluation::of($this->assertion)->with($elementsAfterShrink)->onFailure($onGoodShrink)->onSuccess($onBadShrink)->execute();
     }
     throw new \RuntimeException("Eris has reached the time limit for shrinking, here it is presenting the simplest failure case." . PHP_EOL . "If you can afford to spend more time to find a simpler failing input, increase \$this->shrinkingTimeLimit or set it to null to remove it.", -1, $exception);
 }
All Usage Examples Of Eris\Quantifier\Evaluation::of