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