| @@ 33-52 (lines=20) @@ | ||
| 30 | $this->check(array($call1, $call2), $object, $method)->shouldReturn(null); |
|
| 31 | } |
|
| 32 | ||
| 33 | function it_throws_UnexpectedCallsCountException_if_calls_found( |
|
| 34 | ObjectProphecy $object, |
|
| 35 | MethodProphecy $method, |
|
| 36 | Call $call, |
|
| 37 | ArgumentsWildcard $arguments |
|
| 38 | ) { |
|
| 39 | $object->reveal()->willReturn(new \stdClass()); |
|
| 40 | $object->findProphecyMethodCalls('getName', Argument::any())->willReturn(array()); |
|
| 41 | $method->getObjectProphecy()->willReturn($object); |
|
| 42 | $method->getMethodName()->willReturn('getName'); |
|
| 43 | $method->getArgumentsWildcard()->willReturn($arguments); |
|
| 44 | $arguments->__toString()->willReturn('123'); |
|
| 45 | ||
| 46 | $call->getMethodName()->willReturn('getName'); |
|
| 47 | $call->getArguments()->willReturn(array(5, 4, 'three')); |
|
| 48 | $call->getCallPlace()->willReturn('unknown'); |
|
| 49 | ||
| 50 | $this->shouldThrow('Prophecy\Exception\Prediction\UnexpectedCallsCountException') |
|
| 51 | ->duringCheck(array($call), $object, $method); |
|
| 52 | } |
|
| 53 | } |
|
| 54 | ||
| @@ 23-41 (lines=19) @@ | ||
| 20 | $this->check(array(), $object, $method)->shouldReturn(null); |
|
| 21 | } |
|
| 22 | ||
| 23 | function it_throws_UnexpectedCallsException_if_calls_found( |
|
| 24 | ObjectProphecy $object, |
|
| 25 | MethodProphecy $method, |
|
| 26 | Call $call, |
|
| 27 | ArgumentsWildcard $arguments |
|
| 28 | ) { |
|
| 29 | $object->reveal()->willReturn(new \stdClass); |
|
| 30 | $method->getObjectProphecy()->willReturn($object); |
|
| 31 | $method->getMethodName()->willReturn('getName'); |
|
| 32 | $method->getArgumentsWildcard()->willReturn($arguments); |
|
| 33 | $arguments->__toString()->willReturn('123'); |
|
| 34 | ||
| 35 | $call->getMethodName()->willReturn('getName'); |
|
| 36 | $call->getArguments()->willReturn(array(5, 4, 'three')); |
|
| 37 | $call->getCallPlace()->willReturn('unknown'); |
|
| 38 | ||
| 39 | $this->shouldThrow('Prophecy\Exception\Prediction\UnexpectedCallsException') |
|
| 40 | ->duringCheck(array($call), $object, $method); |
|
| 41 | } |
|
| 42 | } |
|
| 43 | ||