Drupal investigation

CallPredictionSpec.php 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace spec\Prophecy\Prediction;
  3. use PhpSpec\ObjectBehavior;
  4. use Prophecy\Argument;
  5. use Prophecy\Argument\ArgumentsWildcard;
  6. use Prophecy\Call\Call;
  7. use Prophecy\Prophecy\MethodProphecy;
  8. use Prophecy\Prophecy\ObjectProphecy;
  9. class CallPredictionSpec extends ObjectBehavior
  10. {
  11. function it_is_prediction()
  12. {
  13. $this->shouldHaveType('Prophecy\Prediction\PredictionInterface');
  14. }
  15. function it_does_nothing_if_there_is_more_than_one_call_been_made(
  16. ObjectProphecy $object,
  17. MethodProphecy $method,
  18. Call $call
  19. ) {
  20. $this->check(array($call), $object, $method)->shouldReturn(null);
  21. }
  22. function it_throws_NoCallsException_if_no_calls_found(
  23. ObjectProphecy $object,
  24. MethodProphecy $method,
  25. ArgumentsWildcard $arguments
  26. ) {
  27. $method->getObjectProphecy()->willReturn($object);
  28. $method->getMethodName()->willReturn('getName');
  29. $method->getArgumentsWildcard()->willReturn($arguments);
  30. $arguments->__toString()->willReturn('123');
  31. $object->reveal()->willReturn(new \stdClass());
  32. $object->findProphecyMethodCalls('getName', Argument::any())->willReturn(array());
  33. $this->shouldThrow('Prophecy\Exception\Prediction\NoCallsException')
  34. ->duringCheck(array(), $object, $method);
  35. }
  36. }