Пример #1
0
 /**
  * @param \Kodova\Poser\Invocation\Invocation $wanted
  * @param \Kodova\Poser\Invocation\InvocationContainer $invocationContainer
  * @throws TimesException
  */
 public function verify(Invocation $wanted, InvocationContainer $invocationContainer)
 {
     $invocations = $invocationContainer->getInvocations(function (Invocation $invocation) use($wanted) {
         if ($invocation->wasStubbed()) {
             return false;
         }
         return $wanted->matches($invocation);
     });
     $actual = sizeof($invocations);
     if ($this->wantedCount == 0 && $actual > 0) {
         throw new TimesException($this->wantedCount, $invocations);
     } elseif ($this->wantedCount < $actual) {
         throw new TimesException($this->wantedCount, $invocations);
     } elseif ($this->wantedCount > $actual) {
         throw new TimesException($this->wantedCount, $invocations);
     }
 }