@@ 10-39 (lines=30) @@ | ||
7 | { |
|
8 | private $samepleJson; |
|
9 | ||
10 | public function testRecognizeFirstChildOfAnEntity() |
|
11 | { |
|
12 | $this->samepleJson = [ |
|
13 | "AppBundle\\Entity\\Bar" => [ |
|
14 | "relations" => [ |
|
15 | "fizz" => "AppBundle\\Entity\\Fizz", |
|
16 | ] |
|
17 | ], |
|
18 | ]; |
|
19 | ||
20 | $this->mapper = $this |
|
21 | ->getMockBuilder('Mado\QueryBundle\Component\Meta\RelationDatamapper') |
|
22 | ->disableOriginalConstructor() |
|
23 | ->getMock(); |
|
24 | ||
25 | $this->mapper->expects($this->once()) |
|
26 | ->method('getMap') |
|
27 | ->will($this->returnValue( |
|
28 | $this->samepleJson |
|
29 | )); |
|
30 | ||
31 | $this->pathFinder = new JsonPathFinder( |
|
32 | $this->mapper |
|
33 | ); |
|
34 | ||
35 | $this->assertEquals( |
|
36 | "AppBundle\\Entity\\Fizz", |
|
37 | $this->pathFinder->getFirstChildOf("AppBundle\\Entity\\Bar") |
|
38 | ); |
|
39 | } |
|
40 | ||
41 | public function testCatchRootEntityOfInnerOne() |
|
42 | { |
|
@@ 41-70 (lines=30) @@ | ||
38 | ); |
|
39 | } |
|
40 | ||
41 | public function testCatchRootEntityOfInnerOne() |
|
42 | { |
|
43 | $this->samepleJson = [ |
|
44 | "AppBundle\\Entity\\Bar" => [ |
|
45 | "relations" => [ |
|
46 | "fizz" => "AppBundle\\Entity\\Fizz", |
|
47 | ] |
|
48 | ], |
|
49 | ]; |
|
50 | ||
51 | $this->mapper = $this |
|
52 | ->getMockBuilder('Mado\QueryBundle\Component\Meta\RelationDatamapper') |
|
53 | ->disableOriginalConstructor() |
|
54 | ->getMock(); |
|
55 | ||
56 | $this->mapper->expects($this->once()) |
|
57 | ->method('getMap') |
|
58 | ->will($this->returnValue( |
|
59 | $this->samepleJson |
|
60 | )); |
|
61 | ||
62 | $this->pathFinder = new JsonPathFinder( |
|
63 | $this->mapper |
|
64 | ); |
|
65 | ||
66 | $this->assertEquals( |
|
67 | "AppBundle\\Entity\\Bar", |
|
68 | $this->pathFinder->getFirstParentOf("AppBundle\\Entity\\Fizz") |
|
69 | ); |
|
70 | } |
|
71 | ||
72 | public function testCatchRelationNameToInnerEntity() |
|
73 | { |
|
@@ 72-101 (lines=30) @@ | ||
69 | ); |
|
70 | } |
|
71 | ||
72 | public function testCatchRelationNameToInnerEntity() |
|
73 | { |
|
74 | $this->samepleJson = [ |
|
75 | "AppBundle\\Entity\\Bar" => [ |
|
76 | "relations" => [ |
|
77 | "fizz" => "AppBundle\\Entity\\Fizz", |
|
78 | ] |
|
79 | ], |
|
80 | ]; |
|
81 | ||
82 | $this->mapper = $this |
|
83 | ->getMockBuilder('Mado\QueryBundle\Component\Meta\RelationDatamapper') |
|
84 | ->disableOriginalConstructor() |
|
85 | ->getMock(); |
|
86 | ||
87 | $this->mapper->expects($this->once()) |
|
88 | ->method('getMap') |
|
89 | ->will($this->returnValue( |
|
90 | $this->samepleJson |
|
91 | )); |
|
92 | ||
93 | $this->pathFinder = new JsonPathFinder( |
|
94 | $this->mapper |
|
95 | ); |
|
96 | ||
97 | $this->assertEquals( |
|
98 | "fizz", |
|
99 | $this->pathFinder->getSourceRelation("AppBundle\\Entity\\Fizz") |
|
100 | ); |
|
101 | } |
|
102 | ||
103 | public function testLookForPathFromStartEntityToDestination() |
|
104 | { |