CallbackPredictionSpec.php (889B)
1 <?php 2 3 namespace spec\Prophecy\Prediction; 4 5 use PhpSpec\ObjectBehavior; 6 7 use RuntimeException; 8 9 class CallbackPredictionSpec extends ObjectBehavior 10 { 11 function let() 12 { 13 $this->beConstructedWith('get_class'); 14 } 15 16 function it_is_prediction() 17 { 18 $this->shouldHaveType('Prophecy\Prediction\PredictionInterface'); 19 } 20 21 /** 22 * @param \Prophecy\Prophecy\ObjectProphecy $object 23 * @param \Prophecy\Prophecy\MethodProphecy $method 24 * @param \Prophecy\Call\Call $call 25 */ 26 function it_proxies_call_to_callback($object, $method, $call) 27 { 28 $returnFirstCallCallback = function ($calls, $object, $method) { 29 throw new RuntimeException; 30 }; 31 32 $this->beConstructedWith($returnFirstCallCallback); 33 34 $this->shouldThrow('RuntimeException')->duringCheck(array($call), $object, $method); 35 } 36 }