Drupal investigation

NoCallsPredictionSpec.php 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace spec\Prophecy\Prediction;
  3. use PhpSpec\ObjectBehavior;
  4. use Prophecy\Argument\ArgumentsWildcard;
  5. use Prophecy\Call\Call;
  6. use Prophecy\Prophecy\MethodProphecy;
  7. use Prophecy\Prophecy\ObjectProphecy;
  8. class NoCallsPredictionSpec extends ObjectBehavior
  9. {
  10. function it_is_prediction()
  11. {
  12. $this->shouldHaveType('Prophecy\Prediction\PredictionInterface');
  13. }
  14. function it_does_nothing_if_there_is_no_calls_made(ObjectProphecy $object, MethodProphecy $method)
  15. {
  16. $this->check(array(), $object, $method)->shouldReturn(null);
  17. }
  18. function it_throws_UnexpectedCallsException_if_calls_found(
  19. ObjectProphecy $object,
  20. MethodProphecy $method,
  21. Call $call,
  22. ArgumentsWildcard $arguments
  23. ) {
  24. $method->getObjectProphecy()->willReturn($object);
  25. $method->getMethodName()->willReturn('getName');
  26. $method->getArgumentsWildcard()->willReturn($arguments);
  27. $arguments->__toString()->willReturn('123');
  28. $call->getMethodName()->willReturn('getName');
  29. $call->getArguments()->willReturn(array(5, 4, 'three'));
  30. $call->getCallPlace()->willReturn('unknown');
  31. $this->shouldThrow('Prophecy\Exception\Prediction\UnexpectedCallsException')
  32. ->duringCheck(array($call), $object, $method);
  33. }
  34. }