@@ 69-86 (lines=18) @@ | ||
66 | $this->assertTrue($this->securityChecker->isGranted('show', $this->createStdClassMock())); |
|
67 | } |
|
68 | ||
69 | public function testIsGrantedWithVoter() |
|
70 | { |
|
71 | $this->parameterResolver |
|
72 | ->expects($this->once()) |
|
73 | ->method('resolveVoter') |
|
74 | ->will($this->returnValue(true)); |
|
75 | ||
76 | $this->authorizationChecker |
|
77 | ->expects($this->once()) |
|
78 | ->method('isGranted') |
|
79 | ->with( |
|
80 | $this->identicalTo('lug.'.($action = 'show')), |
|
81 | $this->identicalTo($object = $this->createStdClassMock()) |
|
82 | ) |
|
83 | ->will($this->returnValue(true)); |
|
84 | ||
85 | $this->assertTrue($this->securityChecker->isGranted($action, $object)); |
|
86 | } |
|
87 | ||
88 | /** |
|
89 | * @return \PHPUnit_Framework_MockObject_MockObject|AuthorizationCheckerInterface |
@@ 59-73 (lines=15) @@ | ||
56 | $this->assertFalse($this->parameterResolver->resolveApi()); |
|
57 | } |
|
58 | ||
59 | public function testResolveApiWihApiRequest() |
|
60 | { |
|
61 | $this->requestStack |
|
62 | ->expects($this->exactly(2)) |
|
63 | ->method('getMasterRequest') |
|
64 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
65 | ||
66 | $request->attributes |
|
67 | ->expects($this->once()) |
|
68 | ->method('get') |
|
69 | ->with($this->identicalTo('_lug_api'), $this->identicalTo(false)) |
|
70 | ->will($this->returnValue(true)); |
|
71 | ||
72 | $this->assertTrue($this->parameterResolver->resolveApi()); |
|
73 | } |
|
74 | ||
75 | public function testResolveApiWithHtmlRequest() |
|
76 | { |
|
@@ 396-410 (lines=15) @@ | ||
393 | $this->assertFalse($this->parameterResolver->resolveHateoas()); |
|
394 | } |
|
395 | ||
396 | public function testResolveHateoasExplicit() |
|
397 | { |
|
398 | $this->requestStack |
|
399 | ->expects($this->once()) |
|
400 | ->method('getMasterRequest') |
|
401 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
402 | ||
403 | $request->attributes |
|
404 | ->expects($this->once()) |
|
405 | ->method('get') |
|
406 | ->with($this->identicalTo('_lug_hateoas'), $this->identicalTo(false)) |
|
407 | ->will($this->returnValue(true)); |
|
408 | ||
409 | $this->assertTrue($this->parameterResolver->resolveHateoas()); |
|
410 | } |
|
411 | ||
412 | public function testResolveLocationRoute() |
|
413 | { |
|
@@ 734-748 (lines=15) @@ | ||
731 | $this->assertFalse($this->parameterResolver->resolveRedirectRouteParametersForward()); |
|
732 | } |
|
733 | ||
734 | public function testResolveRedirectRouteParametersForwardExplicit() |
|
735 | { |
|
736 | $this->requestStack |
|
737 | ->expects($this->once()) |
|
738 | ->method('getMasterRequest') |
|
739 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
740 | ||
741 | $request->attributes |
|
742 | ->expects($this->once()) |
|
743 | ->method('get') |
|
744 | ->with($this->identicalTo('_lug_redirect_route_parameters_forward'), $this->identicalTo(false)) |
|
745 | ->will($this->returnValue(true)); |
|
746 | ||
747 | $this->assertTrue($this->parameterResolver->resolveRedirectRouteParametersForward()); |
|
748 | } |
|
749 | ||
750 | public function testResolveRepositoryMethodWithoutRequest() |
|
751 | { |
|
@@ 856-870 (lines=15) @@ | ||
853 | $this->assertTrue($this->parameterResolver->resolveSerializerNull()); |
|
854 | } |
|
855 | ||
856 | public function testResolveSerializerNullDefault() |
|
857 | { |
|
858 | $this->requestStack |
|
859 | ->expects($this->once()) |
|
860 | ->method('getMasterRequest') |
|
861 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
862 | ||
863 | $request->attributes |
|
864 | ->expects($this->once()) |
|
865 | ->method('get') |
|
866 | ->with($this->identicalTo('_lug_serializer_null'), $this->identicalTo($null = true)) |
|
867 | ->will($this->returnValue($null)); |
|
868 | ||
869 | $this->assertTrue($this->parameterResolver->resolveSerializerNull()); |
|
870 | } |
|
871 | ||
872 | public function testResolveSerializerNullExplicit() |
|
873 | { |
|
@@ 1191-1205 (lines=15) @@ | ||
1188 | $this->assertFalse($this->parameterResolver->resolveVoter()); |
|
1189 | } |
|
1190 | ||
1191 | public function testResolveVoterExplicit() |
|
1192 | { |
|
1193 | $this->requestStack |
|
1194 | ->expects($this->once()) |
|
1195 | ->method('getMasterRequest') |
|
1196 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
1197 | ||
1198 | $request->attributes |
|
1199 | ->expects($this->once()) |
|
1200 | ->method('get') |
|
1201 | ->with($this->identicalTo('_lug_voter'), $this->identicalTo(false)) |
|
1202 | ->will($this->returnValue(true)); |
|
1203 | ||
1204 | $this->assertTrue($this->parameterResolver->resolveVoter()); |
|
1205 | } |
|
1206 | ||
1207 | /** |
|
1208 | * @return \PHPUnit_Framework_MockObject_MockObject|RequestStack |