AggregateExceptionSpec.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace spec\Prophecy\Exception\Prediction;
  3. use PhpSpec\ObjectBehavior;
  4. use Prophecy\Exception\Prediction\PredictionException;
  5. use Prophecy\Prophecy\ObjectProphecy;
  6. class AggregateExceptionSpec extends ObjectBehavior
  7. {
  8. function let()
  9. {
  10. $this->beConstructedWith(null);
  11. }
  12. function it_is_prediction_exception()
  13. {
  14. $this->shouldBeAnInstanceOf('RuntimeException');
  15. $this->shouldBeAnInstanceOf('Prophecy\Exception\Prediction\PredictionException');
  16. }
  17. function it_can_store_objectProphecy_link(ObjectProphecy $object)
  18. {
  19. $this->setObjectProphecy($object);
  20. $this->getObjectProphecy()->shouldReturn($object);
  21. }
  22. function it_should_not_have_exceptions_at_the_beginning()
  23. {
  24. $this->getExceptions()->shouldHaveCount(0);
  25. }
  26. function it_should_append_exception_through_append_method(PredictionException $exception)
  27. {
  28. $exception->getMessage()->willReturn('Exception #1');
  29. $this->append($exception);
  30. $this->getExceptions()->shouldReturn(array($exception));
  31. }
  32. function it_should_update_message_during_append(PredictionException $exception)
  33. {
  34. $exception->getMessage()->willReturn('Exception #1');
  35. $this->append($exception);
  36. $this->getMessage()->shouldReturn(" Exception #1");
  37. }
  38. }