@@ 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 testResolveTemplate() |
|
903 | { |
|
@@ 958-972 (lines=15) @@ | ||
955 | $this->assertEmpty($this->parameterResolver->resolveThemes()); |
|
956 | } |
|
957 | ||
958 | public function testResolveThemesDefault() |
|
959 | { |
|
960 | $this->requestStack |
|
961 | ->expects($this->once()) |
|
962 | ->method('getMasterRequest') |
|
963 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
964 | ||
965 | $request->attributes |
|
966 | ->expects($this->once()) |
|
967 | ->method('get') |
|
968 | ->with($this->identicalTo('_lug_themes'), $this->identicalTo($themes = [])) |
|
969 | ->will($this->returnValue($themes)); |
|
970 | ||
971 | $this->assertEmpty($this->parameterResolver->resolveThemes()); |
|
972 | } |
|
973 | ||
974 | public function testResolveThemesExplicit() |
|
975 | { |
|
@@ 974-988 (lines=15) @@ | ||
971 | $this->assertEmpty($this->parameterResolver->resolveThemes()); |
|
972 | } |
|
973 | ||
974 | public function testResolveThemesExplicit() |
|
975 | { |
|
976 | $this->requestStack |
|
977 | ->expects($this->once()) |
|
978 | ->method('getMasterRequest') |
|
979 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
980 | ||
981 | $request->attributes |
|
982 | ->expects($this->once()) |
|
983 | ->method('get') |
|
984 | ->with($this->identicalTo('_lug_themes'), $this->identicalTo([])) |
|
985 | ->will($this->returnValue($themes = ['theme'])); |
|
986 | ||
987 | $this->assertSame($themes, $this->parameterResolver->resolveThemes()); |
|
988 | } |
|
989 | ||
990 | public function testResolveTranslationDomainWithoutRequest() |
|
991 | { |
|
@@ 1088-1102 (lines=15) @@ | ||
1085 | $this->assertEmpty($this->parameterResolver->resolveValidationGroups()); |
|
1086 | } |
|
1087 | ||
1088 | public function testResolveValidationGroupsDefault() |
|
1089 | { |
|
1090 | $this->requestStack |
|
1091 | ->expects($this->once()) |
|
1092 | ->method('getMasterRequest') |
|
1093 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
1094 | ||
1095 | $request->attributes |
|
1096 | ->expects($this->once()) |
|
1097 | ->method('get') |
|
1098 | ->with($this->identicalTo('_lug_validation_groups'), $this->identicalTo($groups = [])) |
|
1099 | ->will($this->returnValue($groups)); |
|
1100 | ||
1101 | $this->assertEmpty($this->parameterResolver->resolveValidationGroups()); |
|
1102 | } |
|
1103 | ||
1104 | public function testResolveValidationGroupsExplicit() |
|
1105 | { |
|
@@ 1104-1118 (lines=15) @@ | ||
1101 | $this->assertEmpty($this->parameterResolver->resolveValidationGroups()); |
|
1102 | } |
|
1103 | ||
1104 | public function testResolveValidationGroupsExplicit() |
|
1105 | { |
|
1106 | $this->requestStack |
|
1107 | ->expects($this->once()) |
|
1108 | ->method('getMasterRequest') |
|
1109 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
1110 | ||
1111 | $request->attributes |
|
1112 | ->expects($this->once()) |
|
1113 | ->method('get') |
|
1114 | ->with($this->identicalTo('_lug_validation_groups'), $this->identicalTo([])) |
|
1115 | ->will($this->returnValue($groups = ['group'])); |
|
1116 | ||
1117 | $this->assertSame($groups, $this->parameterResolver->resolveValidationGroups()); |
|
1118 | } |
|
1119 | ||
1120 | public function testResolveVoterWithoutRequest() |
|
1121 | { |