@@ 675-689 (lines=15) @@ | ||
672 | ); |
|
673 | } |
|
674 | ||
675 | public function testResolveRedirectRouteParametersWithoutObject() |
|
676 | { |
|
677 | $this->requestStack |
|
678 | ->expects($this->once()) |
|
679 | ->method('getMasterRequest') |
|
680 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
681 | ||
682 | $request->attributes |
|
683 | ->expects($this->once()) |
|
684 | ->method('get') |
|
685 | ->with($this->identicalTo('_lug_redirect_route_parameters'), $this->identicalTo([])) |
|
686 | ->will($this->returnValue([])); |
|
687 | ||
688 | $this->assertEmpty($this->parameterResolver->resolveRedirectRouteParameters()); |
|
689 | } |
|
690 | ||
691 | /** |
|
692 | * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException |
|
@@ 695-709 (lines=15) @@ | ||
692 | * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException |
|
693 | * @expectedExceptionMessage The route parameters could not be found for the route "redirect_route_parameters". |
|
694 | */ |
|
695 | public function testResolveRedirectRouteParametersWithObjectMissing() |
|
696 | { |
|
697 | $this->requestStack |
|
698 | ->expects($this->once()) |
|
699 | ->method('getMasterRequest') |
|
700 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
701 | ||
702 | $request->attributes |
|
703 | ->expects($this->once()) |
|
704 | ->method('get') |
|
705 | ->with($this->identicalTo('_lug_redirect_route_parameters'), $this->identicalTo([])) |
|
706 | ->will($this->returnValue(['id'])); |
|
707 | ||
708 | $this->assertEmpty($this->parameterResolver->resolveRedirectRouteParameters()); |
|
709 | } |
|
710 | ||
711 | public function testResolveRedirectRouteParametersForwardWithoutRequest() |
|
712 | { |
|
@@ 790-804 (lines=15) @@ | ||
787 | $this->assertEmpty($this->parameterResolver->resolveSerializerGroups()); |
|
788 | } |
|
789 | ||
790 | public function testResolveSerializerGroupsDefault() |
|
791 | { |
|
792 | $this->requestStack |
|
793 | ->expects($this->once()) |
|
794 | ->method('getMasterRequest') |
|
795 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
796 | ||
797 | $request->attributes |
|
798 | ->expects($this->once()) |
|
799 | ->method('get') |
|
800 | ->with( |
|
801 | $this->identicalTo('_lug_serializer_groups'), |
|
802 | $this->identicalTo($groups = []) |
|
803 | ) |
|
804 | ->will($this->returnValue($groups)); |
|
805 | ||
806 | $this->assertEmpty($this->parameterResolver->resolveSerializerGroups()); |
|
807 | } |
|
@@ 870-884 (lines=15) @@ | ||
867 | $this->assertEmpty($this->parameterResolver->resolveSorting()); |
|
868 | } |
|
869 | ||
870 | public function testResolveSortingDefault() |
|
871 | { |
|
872 | $this->requestStack |
|
873 | ->expects($this->once()) |
|
874 | ->method('getMasterRequest') |
|
875 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
876 | ||
877 | $request->attributes |
|
878 | ->expects($this->once()) |
|
879 | ->method('get') |
|
880 | ->with($this->identicalTo('_lug_sorting'), $this->identicalTo($sorting = [])) |
|
881 | ->will($this->returnValue($sorting)); |
|
882 | ||
883 | $this->assertEmpty($this->parameterResolver->resolveSorting()); |
|
884 | } |
|
885 | ||
886 | public function testResolveSortingExplicit() |
|
887 | { |
|
@@ 886-900 (lines=15) @@ | ||
883 | $this->assertEmpty($this->parameterResolver->resolveSorting()); |
|
884 | } |
|
885 | ||
886 | public function testResolveSortingExplicit() |
|
887 | { |
|
888 | $this->requestStack |
|
889 | ->expects($this->once()) |
|
890 | ->method('getMasterRequest') |
|
891 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
892 | ||
893 | $request->attributes |
|
894 | ->expects($this->once()) |
|
895 | ->method('get') |
|
896 | ->with($this->identicalTo('_lug_sorting'), $this->identicalTo([])) |
|
897 | ->will($this->returnValue($sorting = ['foo' => 'ASC'])); |
|
898 | ||
899 | $this->assertSame($sorting, $this->parameterResolver->resolveSorting()); |
|
900 | } |
|
901 | ||
902 | public function testResolveStatusCodeWithoutRequest() |
|
903 | { |
|
@@ 907-921 (lines=15) @@ | ||
904 | $this->assertSame($statusCode = 200, $this->parameterResolver->resolveStatusCode($statusCode)); |
|
905 | } |
|
906 | ||
907 | public function testResolveStatusCodeDefault() |
|
908 | { |
|
909 | $this->requestStack |
|
910 | ->expects($this->once()) |
|
911 | ->method('getMasterRequest') |
|
912 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
913 | ||
914 | $request->attributes |
|
915 | ->expects($this->once()) |
|
916 | ->method('get') |
|
917 | ->with($this->identicalTo('_lug_status_code'), $this->identicalTo($statusCode = 200)) |
|
918 | ->will($this->returnValue($statusCode)); |
|
919 | ||
920 | $this->assertSame($statusCode, $this->parameterResolver->resolveStatusCode($statusCode)); |
|
921 | } |
|
922 | ||
923 | public function testResolveStatusCodeExplicit() |
|
924 | { |
|
@@ 995-1009 (lines=15) @@ | ||
992 | $this->assertEmpty($this->parameterResolver->resolveThemes()); |
|
993 | } |
|
994 | ||
995 | public function testResolveThemesDefault() |
|
996 | { |
|
997 | $this->requestStack |
|
998 | ->expects($this->once()) |
|
999 | ->method('getMasterRequest') |
|
1000 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
1001 | ||
1002 | $request->attributes |
|
1003 | ->expects($this->once()) |
|
1004 | ->method('get') |
|
1005 | ->with($this->identicalTo('_lug_themes'), $this->identicalTo($themes = [])) |
|
1006 | ->will($this->returnValue($themes)); |
|
1007 | ||
1008 | $this->assertEmpty($this->parameterResolver->resolveThemes()); |
|
1009 | } |
|
1010 | ||
1011 | public function testResolveThemesExplicit() |
|
1012 | { |
|
@@ 1011-1025 (lines=15) @@ | ||
1008 | $this->assertEmpty($this->parameterResolver->resolveThemes()); |
|
1009 | } |
|
1010 | ||
1011 | public function testResolveThemesExplicit() |
|
1012 | { |
|
1013 | $this->requestStack |
|
1014 | ->expects($this->once()) |
|
1015 | ->method('getMasterRequest') |
|
1016 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
1017 | ||
1018 | $request->attributes |
|
1019 | ->expects($this->once()) |
|
1020 | ->method('get') |
|
1021 | ->with($this->identicalTo('_lug_themes'), $this->identicalTo([])) |
|
1022 | ->will($this->returnValue($themes = ['theme'])); |
|
1023 | ||
1024 | $this->assertSame($themes, $this->parameterResolver->resolveThemes()); |
|
1025 | } |
|
1026 | ||
1027 | public function testResolveTranslationDomainWithoutRequest() |
|
1028 | { |
|
@@ 1125-1139 (lines=15) @@ | ||
1122 | $this->assertEmpty($this->parameterResolver->resolveValidationGroups()); |
|
1123 | } |
|
1124 | ||
1125 | public function testResolveValidationGroupsDefault() |
|
1126 | { |
|
1127 | $this->requestStack |
|
1128 | ->expects($this->once()) |
|
1129 | ->method('getMasterRequest') |
|
1130 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
1131 | ||
1132 | $request->attributes |
|
1133 | ->expects($this->once()) |
|
1134 | ->method('get') |
|
1135 | ->with($this->identicalTo('_lug_validation_groups'), $this->identicalTo($groups = [])) |
|
1136 | ->will($this->returnValue($groups)); |
|
1137 | ||
1138 | $this->assertEmpty($this->parameterResolver->resolveValidationGroups()); |
|
1139 | } |
|
1140 | ||
1141 | public function testResolveValidationGroupsExplicit() |
|
1142 | { |
|
@@ 1141-1155 (lines=15) @@ | ||
1138 | $this->assertEmpty($this->parameterResolver->resolveValidationGroups()); |
|
1139 | } |
|
1140 | ||
1141 | public function testResolveValidationGroupsExplicit() |
|
1142 | { |
|
1143 | $this->requestStack |
|
1144 | ->expects($this->once()) |
|
1145 | ->method('getMasterRequest') |
|
1146 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
1147 | ||
1148 | $request->attributes |
|
1149 | ->expects($this->once()) |
|
1150 | ->method('get') |
|
1151 | ->with($this->identicalTo('_lug_validation_groups'), $this->identicalTo([])) |
|
1152 | ->will($this->returnValue($groups = ['group'])); |
|
1153 | ||
1154 | $this->assertSame($groups, $this->parameterResolver->resolveValidationGroups()); |
|
1155 | } |
|
1156 | ||
1157 | public function testResolveVoterWithoutRequest() |
|
1158 | { |