No Description

AggregateExceptionSpec.php 1.4KB

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