CallbackPredictionSpec.php 889 B

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