CallSpec.php 1.2 KB

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