@@ 200-234 (lines=35) @@ | ||
197 | $this->pathFinder->getPathToEntity("AppBundle\\Entity\\Family"); |
|
198 | } |
|
199 | ||
200 | public function testCountNumberOfParentWithDestinationPath() |
|
201 | { |
|
202 | $this->samepleJson = [ |
|
203 | "GammaBundle\\Entity\\Zzz" => [ |
|
204 | "relations" => [ |
|
205 | "items" => "AppBundle\\Entity\\Foo", |
|
206 | ] |
|
207 | ], |
|
208 | "GammaBundle\\Entity\\Item" => [ |
|
209 | "relations" => [ |
|
210 | "items" => "AppBundle\\Entity\\Foo", |
|
211 | ] |
|
212 | ], |
|
213 | ]; |
|
214 | ||
215 | $this->mapper = $this |
|
216 | ->getMockBuilder('Mado\QueryBundle\Component\Meta\RelationDatamapper') |
|
217 | ->disableOriginalConstructor() |
|
218 | ->getMock(); |
|
219 | ||
220 | $this->mapper->expects($this->once()) |
|
221 | ->method('getMap') |
|
222 | ->will($this->returnValue( |
|
223 | $this->samepleJson |
|
224 | )); |
|
225 | ||
226 | $this->pathFinder = new JsonPathFinder( |
|
227 | $this->mapper |
|
228 | ); |
|
229 | ||
230 | $this->assertEquals( |
|
231 | 2, |
|
232 | $this->pathFinder->numberOfRealtionTo("AppBundle\\Entity\\Foo") |
|
233 | ); |
|
234 | } |
|
235 | ||
236 | public function testListParentOfEntity() |
|
237 | { |
|
@@ 236-273 (lines=38) @@ | ||
233 | ); |
|
234 | } |
|
235 | ||
236 | public function testListParentOfEntity() |
|
237 | { |
|
238 | $this->samepleJson = [ |
|
239 | "GammaBundle\\Entity\\Zzz" => [ |
|
240 | "relations" => [ |
|
241 | "items" => "AppBundle\\Entity\\Foo", |
|
242 | ] |
|
243 | ], |
|
244 | "GammaBundle\\Entity\\Item" => [ |
|
245 | "relations" => [ |
|
246 | "items" => "AppBundle\\Entity\\Foo", |
|
247 | ] |
|
248 | ], |
|
249 | ]; |
|
250 | ||
251 | $this->mapper = $this |
|
252 | ->getMockBuilder('Mado\QueryBundle\Component\Meta\RelationDatamapper') |
|
253 | ->disableOriginalConstructor() |
|
254 | ->getMock(); |
|
255 | ||
256 | $this->mapper->expects($this->once()) |
|
257 | ->method('getMap') |
|
258 | ->will($this->returnValue( |
|
259 | $this->samepleJson |
|
260 | )); |
|
261 | ||
262 | $this->pathFinder = new JsonPathFinder( |
|
263 | $this->mapper |
|
264 | ); |
|
265 | ||
266 | $this->assertEquals( |
|
267 | [ |
|
268 | "GammaBundle\\Entity\\Zzz", |
|
269 | "GammaBundle\\Entity\\Item", |
|
270 | ], |
|
271 | $this->pathFinder->listOfParentsOf("AppBundle\\Entity\\Foo") |
|
272 | ); |
|
273 | } |
|
274 | ||
275 | public function testBuildRightPathAlsoWithMoreDifferentParentsAtTheEnd() |
|
276 | { |