CallbackPredictionSpec.php 842 B

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