CallSpec.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace spec\Prophecy\Call;
  3. use PhpSpec\ObjectBehavior;
  4. class CallSpec extends ObjectBehavior
  5. {
  6. /**
  7. * @param \Exception $exception
  8. */
  9. function let($exception)
  10. {
  11. $this->beConstructedWith('setValues', array(5, 2), 42, $exception, 'some_file.php', 23);
  12. }
  13. function it_exposes_method_name_through_getter()
  14. {
  15. $this->getMethodName()->shouldReturn('setValues');
  16. }
  17. function it_exposes_arguments_through_getter()
  18. {
  19. $this->getArguments()->shouldReturn(array(5, 2));
  20. }
  21. function it_exposes_return_value_through_getter()
  22. {
  23. $this->getReturnValue()->shouldReturn(42);
  24. }
  25. function it_exposes_exception_through_getter($exception)
  26. {
  27. $this->getException()->shouldReturn($exception);
  28. }
  29. function it_exposes_file_and_line_through_getter()
  30. {
  31. $this->getFile()->shouldReturn('some_file.php');
  32. $this->getLine()->shouldReturn(23);
  33. }
  34. function it_returns_shortpath_to_callPlace()
  35. {
  36. $this->getCallPlace()->shouldReturn('some_file.php:23');
  37. }
  38. function it_returns_unknown_as_callPlace_if_no_file_or_line_provided()
  39. {
  40. $this->beConstructedWith('setValues', array(), 0, null, null, null);
  41. $this->getCallPlace()->shouldReturn('unknown');
  42. }
  43. }