Example #1
0
 /**
  * @param ArgumentCollection $actualArgs
  * @throws VerificationException
  * @return null
  */
 public function call(ArgumentCollection $actualArgs)
 {
     $this->_invokationCounter++;
     $i = 0;
     foreach ($this->_expectedArgs->getArguments() as $index => $expectedArgument) {
         if (!$actualArgs->hasArgumentAtPosition($index)) {
             throw new VerificationException($this, sprintf('Argument %s should be %s, is missing', $i, $expectedArgument->__mokka_getValue()));
         }
         $actualArgument = $actualArgs->getArgumentAtPosition($i);
         if (!$this->_argumentComparator->isEqual($expectedArgument, $actualArgument)) {
             throw new VerificationException($this, sprintf('Argument %s should be %s, is %s', $i, $expectedArgument->__mokka_getValue(), $actualArgument->__mokka_getValue()));
         }
         $i++;
     }
     return null;
 }
Example #2
0
 /**
  * @param int $index
  * @param mixed $expectedArgument
  * @param ArgumentCollection $actualArguments
  * @return bool
  * @throws NotFoundException
  */
 private function _doArgumentsMatch($index, $expectedArgument, ArgumentCollection $actualArguments)
 {
     return $actualArguments->hasArgumentAtPosition($index) && $this->_argumentComparator->isEqual($expectedArgument, $actualArguments->getArgumentAtPosition($index));
 }