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