@@ 231-265 (lines=35) @@ | ||
228 | $this->pathFinder->getPathToEntity("AppBundle\\Entity\\Family"); |
|
229 | } |
|
230 | ||
231 | public function testCountNumberOfParentOfInnerEntity() |
|
232 | { |
|
233 | $this->samepleJson = [ |
|
234 | "GammaBundle\\Entity\\Zzz" => [ |
|
235 | "relations" => [ |
|
236 | "items" => "AppBundle\\Entity\\Foo", |
|
237 | ] |
|
238 | ], |
|
239 | "GammaBundle\\Entity\\Item" => [ |
|
240 | "relations" => [ |
|
241 | "items" => "AppBundle\\Entity\\Foo", |
|
242 | ] |
|
243 | ], |
|
244 | ]; |
|
245 | ||
246 | $this->mapper = $this |
|
247 | ->getMockBuilder('Mado\QueryBundle\Component\Meta\RelationDatamapper') |
|
248 | ->disableOriginalConstructor() |
|
249 | ->getMock(); |
|
250 | ||
251 | $this->mapper->expects($this->once()) |
|
252 | ->method('getMap') |
|
253 | ->will($this->returnValue( |
|
254 | $this->samepleJson |
|
255 | )); |
|
256 | ||
257 | $this->pathFinder = new JsonPathFinder( |
|
258 | $this->mapper |
|
259 | ); |
|
260 | ||
261 | $this->assertEquals( |
|
262 | 2, |
|
263 | $this->pathFinder->numberOfRelationsToEntity("AppBundle\\Entity\\Foo") |
|
264 | ); |
|
265 | } |
|
266 | ||
267 | public function testListParentOfInnerEntity() |
|
268 | { |
|
@@ 267-304 (lines=38) @@ | ||
264 | ); |
|
265 | } |
|
266 | ||
267 | public function testListParentOfInnerEntity() |
|
268 | { |
|
269 | $this->samepleJson = [ |
|
270 | "GammaBundle\\Entity\\Zzz" => [ |
|
271 | "relations" => [ |
|
272 | "items" => "AppBundle\\Entity\\Foo", |
|
273 | ] |
|
274 | ], |
|
275 | "GammaBundle\\Entity\\Item" => [ |
|
276 | "relations" => [ |
|
277 | "items" => "AppBundle\\Entity\\Foo", |
|
278 | ] |
|
279 | ], |
|
280 | ]; |
|
281 | ||
282 | $this->mapper = $this |
|
283 | ->getMockBuilder('Mado\QueryBundle\Component\Meta\RelationDatamapper') |
|
284 | ->disableOriginalConstructor() |
|
285 | ->getMock(); |
|
286 | ||
287 | $this->mapper->expects($this->once()) |
|
288 | ->method('getMap') |
|
289 | ->will($this->returnValue( |
|
290 | $this->samepleJson |
|
291 | )); |
|
292 | ||
293 | $this->pathFinder = new JsonPathFinder( |
|
294 | $this->mapper |
|
295 | ); |
|
296 | ||
297 | $this->assertEquals( |
|
298 | [ |
|
299 | "GammaBundle\\Entity\\Zzz", |
|
300 | "GammaBundle\\Entity\\Item", |
|
301 | ], |
|
302 | $this->pathFinder->listOfParentsOf("AppBundle\\Entity\\Foo") |
|
303 | ); |
|
304 | } |
|
305 | ||
306 | public function testBuildListOfEntityReachedDuringTheWalk() |
|
307 | { |