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