No Description

RevealerSpec.php 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace spec\Prophecy\Prophecy;
  3. use PhpSpec\ObjectBehavior;
  4. class RevealerSpec extends ObjectBehavior
  5. {
  6. function it_is_revealer()
  7. {
  8. $this->shouldBeAnInstanceOf('Prophecy\Prophecy\RevealerInterface');
  9. }
  10. /**
  11. * @param \Prophecy\Prophecy\ProphecyInterface $prophecy
  12. * @param \stdClass $object
  13. */
  14. function it_reveals_single_instance_of_ProphecyInterface($prophecy, $object)
  15. {
  16. $prophecy->reveal()->willReturn($object);
  17. $this->reveal($prophecy)->shouldReturn($object);
  18. }
  19. /**
  20. * @param \Prophecy\Prophecy\ProphecyInterface $prophecy1
  21. * @param \Prophecy\Prophecy\ProphecyInterface $prophecy2
  22. * @param \stdClass $object1
  23. * @param \stdClass $object2
  24. */
  25. function it_reveals_instances_of_ProphecyInterface_inside_array(
  26. $prophecy1, $prophecy2, $object1, $object2
  27. )
  28. {
  29. $prophecy1->reveal()->willReturn($object1);
  30. $prophecy2->reveal()->willReturn($object2);
  31. $this->reveal(array(
  32. array('item' => $prophecy2),
  33. $prophecy1
  34. ))->shouldReturn(array(
  35. array('item' => $object2),
  36. $object1
  37. ));
  38. }
  39. function it_does_not_touch_non_prophecy_interface()
  40. {
  41. $this->reveal(42)->shouldReturn(42);
  42. }
  43. }