Exemple #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;
 }
 public function testGetArguments()
 {
     $expectedArguments = array(new Argument('foo'), new Argument('bar'));
     $collection = new ArgumentCollection(array('foo', 'bar'));
     $this->assertEquals($expectedArguments, $collection->getArguments());
 }