Conditions | 1 |
Paths | 1 |
Total Lines | 21 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | public function testGetIdFromRequest() |
||
19 | { |
||
20 | $idParameter = 'id'; |
||
21 | $requestId = 1; |
||
22 | |||
23 | $adminInterface = $this->getMockForAbstractClass('Sonata\AdminBundle\Admin\AdminInterface'); |
||
24 | $adminInterface->expects($this->once()) |
||
25 | ->method('getIdParameter') |
||
26 | ->will($this->returnValue($idParameter)); |
||
27 | |||
28 | $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request') |
||
29 | ->getMock(); |
||
30 | $request->expects($this->once()) |
||
31 | ->method('get') |
||
32 | ->with($idParameter) |
||
33 | ->will($this->returnValue($requestId)); |
||
34 | |||
35 | $routeIdHandler = new RouteIdHandler(); |
||
36 | $returnId = $routeIdHandler->getIdFromRequest($request, $adminInterface); |
||
37 | $this->assertEquals($requestId, $returnId); |
||
38 | } |
||
39 | } |
||
40 |