Example #1
0
 public function getResultOfCall()
 {
     if (is_null($this->times)) {
         $message = "[{$this->mockName}]\n\nMethod ({$this->methodName}) called but is expected to not be called";
         $this->log("err", $message);
         $this->errors[] = $message;
         throw new MockException($message);
     } elseif ($this->times === 0) {
         $message = "[{$this->mockName}]\n\nMethod ({$this->methodName}) expected to be called {$this->times} times but called at least one more";
         $this->log("err", $message);
         $this->errors[] = $message;
         throw new MockException($message);
     } else {
         $this->times -= 1;
         return parent::getResultOfCall();
     }
 }