No Description

ProphecyComparatorSpec.php 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace spec\Prophecy\Comparator;
  3. use PhpSpec\ObjectBehavior;
  4. use Prophecy\Argument;
  5. use Prophecy\Prophet;
  6. class ProphecyComparatorSpec extends ObjectBehavior
  7. {
  8. function it_is_a_comparator()
  9. {
  10. $this->shouldHaveType('SebastianBergmann\Comparator\ObjectComparator');
  11. }
  12. function it_accepts_only_prophecy_objects()
  13. {
  14. $this->accepts(123, 321)->shouldReturn(false);
  15. $this->accepts('string', 'string')->shouldReturn(false);
  16. $this->accepts(false, true)->shouldReturn(false);
  17. $this->accepts(true, false)->shouldReturn(false);
  18. $this->accepts((object)array(), (object)array())->shouldReturn(false);
  19. $this->accepts(function(){}, (object)array())->shouldReturn(false);
  20. $this->accepts(function(){}, function(){})->shouldReturn(false);
  21. $prophet = new Prophet();
  22. $prophecy = $prophet->prophesize('Prophecy\Prophecy\ObjectProphecy');
  23. $this->accepts($prophecy, $prophecy)->shouldReturn(true);
  24. }
  25. function it_asserts_that_an_object_is_equal_to_its_revealed_prophecy()
  26. {
  27. $prophet = new Prophet();
  28. $prophecy = $prophet->prophesize('Prophecy\Prophecy\ObjectProphecy');
  29. $this->shouldNotThrow()->duringAssertEquals($prophecy->reveal(), $prophecy);
  30. }
  31. }