NoCallsPredictionSpec.php (1449B)
1 <?php 2 3 namespace spec\Prophecy\Prediction; 4 5 use PhpSpec\ObjectBehavior; 6 7 class NoCallsPredictionSpec extends ObjectBehavior 8 { 9 function it_is_prediction() 10 { 11 $this->shouldHaveType('Prophecy\Prediction\PredictionInterface'); 12 } 13 14 /** 15 * @param \Prophecy\Prophecy\ObjectProphecy $object 16 * @param \Prophecy\Prophecy\MethodProphecy $method 17 */ 18 function it_does_nothing_if_there_is_no_calls_made($object, $method) 19 { 20 $this->check(array(), $object, $method)->shouldReturn(null); 21 } 22 23 /** 24 * @param \Prophecy\Prophecy\ObjectProphecy $object 25 * @param \Prophecy\Prophecy\MethodProphecy $method 26 * @param \Prophecy\Call\Call $call 27 * @param \Prophecy\Argument\ArgumentsWildcard $arguments 28 */ 29 function it_throws_UnexpectedCallsException_if_calls_found($object, $method, $call, $arguments) 30 { 31 $method->getObjectProphecy()->willReturn($object); 32 $method->getMethodName()->willReturn('getName'); 33 $method->getArgumentsWildcard()->willReturn($arguments); 34 $arguments->__toString()->willReturn('123'); 35 36 $call->getMethodName()->willReturn('getName'); 37 $call->getArguments()->willReturn(array(5, 4, 'three')); 38 $call->getCallPlace()->willReturn('unknown'); 39 40 $this->shouldThrow('Prophecy\Exception\Prediction\UnexpectedCallsException') 41 ->duringCheck(array($call), $object, $method); 42 } 43 }