示例#1
0
文件: Times.php 项目: kodova/poser
 /**
  * @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);
     }
 }
示例#2
0
文件: Stub.php 项目: kodova/poser
 public function matches(Matchable $invocation)
 {
     return $this->invocation->matches($invocation);
 }