예제 #1
0
 function it_should_return_empty_string_if_argument_counts_do_not_match(UnexpectedCallException $exception, ObjectProphecy $objectProphecy, MethodProphecy $prophecy, ArgumentsWildcard $wildcard)
 {
     $exception->getObjectProphecy()->willReturn($objectProphecy);
     $exception->getArguments()->willReturn(array('a', 'b'));
     $exception->getMethodName()->shouldBeCalled();
     $objectProphecy->getMethodProphecies(Argument::any())->willReturn(array($prophecy));
     $objectProphecy->findProphecyMethodCalls(Argument::any(), Argument::any())->willReturn(array());
     $prophecy->getArgumentsWildcard()->willReturn($wildcard);
     $wildcard->getTokens()->willReturn(array('a'));
     $this->presentDifference($exception)->shouldReturn('');
 }
예제 #2
0
 /**
  * @param MethodProphecy[] $methodProphecies
  * @param UnexpectedCallException $exception
  *
  * @return MethodProphecy
  */
 private function findFirstUnexpectedArgumentsCallProphecy(array $methodProphecies, UnexpectedCallException $exception)
 {
     $objectProphecy = $exception->getObjectProphecy();
     foreach ($methodProphecies as $methodProphecy) {
         $calls = $objectProphecy->findProphecyMethodCalls($exception->getMethodName(), $methodProphecy->getArgumentsWildcard());
         if (count($calls)) {
             continue;
         }
         return $methodProphecy;
     }
 }