@@ 10-39 (lines=30) @@ | ||
7 | { |
|
8 | private $samepleJson; |
|
9 | ||
10 | public function testGetFirstEntityThatPointDirectlyToAnEntity() |
|
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\\Bar", |
|
37 | $this->pathFinder->getFirstParentOf("AppBundle\\Entity\\Fizz") |
|
38 | ); |
|
39 | } |
|
40 | ||
41 | public function testGetRelationNameThatPointToAnEntity() |
|
42 | { |
|
@@ 41-70 (lines=30) @@ | ||
38 | ); |
|
39 | } |
|
40 | ||
41 | public function testGetRelationNameThatPointToAnEntity() |
|
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 | "fizz", |
|
68 | $this->pathFinder->getSourceRelation("AppBundle\\Entity\\Fizz") |
|
69 | ); |
|
70 | } |
|
71 | ||
72 | public function testPathFromEntityToDestination() |
|
73 | { |