@@ 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($this->identicalTo('_lug_serializer_groups'), $this->identicalTo($groups = [])) |
|
801 | ->will($this->returnValue($groups)); |
|
802 | ||
803 | $this->assertEmpty($this->parameterResolver->resolveSerializerGroups()); |
|
804 | } |
|
805 | ||
806 | public function testResolveSerializerGroupsExplicit() |
|
807 | { |
|
@@ 806-820 (lines=15) @@ | ||
803 | $this->assertEmpty($this->parameterResolver->resolveSerializerGroups()); |
|
804 | } |
|
805 | ||
806 | public function testResolveSerializerGroupsExplicit() |
|
807 | { |
|
808 | $this->requestStack |
|
809 | ->expects($this->once()) |
|
810 | ->method('getMasterRequest') |
|
811 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
812 | ||
813 | $request->attributes |
|
814 | ->expects($this->once()) |
|
815 | ->method('get') |
|
816 | ->with($this->identicalTo('_lug_serializer_groups'), $this->identicalTo([])) |
|
817 | ->will($this->returnValue($groups = ['group'])); |
|
818 | ||
819 | $this->assertSame($groups, $this->parameterResolver->resolveSerializerGroups()); |
|
820 | } |
|
821 | ||
822 | public function testResolveSerializerNullWithoutRequest() |
|
823 | { |
|
@@ 864-878 (lines=15) @@ | ||
861 | $this->assertEmpty($this->parameterResolver->resolveSorting()); |
|
862 | } |
|
863 | ||
864 | public function testResolveSortingDefault() |
|
865 | { |
|
866 | $this->requestStack |
|
867 | ->expects($this->once()) |
|
868 | ->method('getMasterRequest') |
|
869 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
870 | ||
871 | $request->attributes |
|
872 | ->expects($this->once()) |
|
873 | ->method('get') |
|
874 | ->with($this->identicalTo('_lug_sorting'), $this->identicalTo($sorting = [])) |
|
875 | ->will($this->returnValue($sorting)); |
|
876 | ||
877 | $this->assertEmpty($this->parameterResolver->resolveSorting()); |
|
878 | } |
|
879 | ||
880 | public function testResolveSortingExplicit() |
|
881 | { |
|
@@ 880-894 (lines=15) @@ | ||
877 | $this->assertEmpty($this->parameterResolver->resolveSorting()); |
|
878 | } |
|
879 | ||
880 | public function testResolveSortingExplicit() |
|
881 | { |
|
882 | $this->requestStack |
|
883 | ->expects($this->once()) |
|
884 | ->method('getMasterRequest') |
|
885 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
886 | ||
887 | $request->attributes |
|
888 | ->expects($this->once()) |
|
889 | ->method('get') |
|
890 | ->with($this->identicalTo('_lug_sorting'), $this->identicalTo([])) |
|
891 | ->will($this->returnValue($sorting = ['foo' => 'ASC'])); |
|
892 | ||
893 | $this->assertSame($sorting, $this->parameterResolver->resolveSorting()); |
|
894 | } |
|
895 | ||
896 | public function testResolveTemplate() |
|
897 | { |
|
@@ 952-966 (lines=15) @@ | ||
949 | $this->assertEmpty($this->parameterResolver->resolveThemes()); |
|
950 | } |
|
951 | ||
952 | public function testResolveThemesDefault() |
|
953 | { |
|
954 | $this->requestStack |
|
955 | ->expects($this->once()) |
|
956 | ->method('getMasterRequest') |
|
957 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
958 | ||
959 | $request->attributes |
|
960 | ->expects($this->once()) |
|
961 | ->method('get') |
|
962 | ->with($this->identicalTo('_lug_themes'), $this->identicalTo($themes = [])) |
|
963 | ->will($this->returnValue($themes)); |
|
964 | ||
965 | $this->assertEmpty($this->parameterResolver->resolveThemes()); |
|
966 | } |
|
967 | ||
968 | public function testResolveThemesExplicit() |
|
969 | { |
|
@@ 968-982 (lines=15) @@ | ||
965 | $this->assertEmpty($this->parameterResolver->resolveThemes()); |
|
966 | } |
|
967 | ||
968 | public function testResolveThemesExplicit() |
|
969 | { |
|
970 | $this->requestStack |
|
971 | ->expects($this->once()) |
|
972 | ->method('getMasterRequest') |
|
973 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
974 | ||
975 | $request->attributes |
|
976 | ->expects($this->once()) |
|
977 | ->method('get') |
|
978 | ->with($this->identicalTo('_lug_themes'), $this->identicalTo([])) |
|
979 | ->will($this->returnValue($themes = ['theme'])); |
|
980 | ||
981 | $this->assertSame($themes, $this->parameterResolver->resolveThemes()); |
|
982 | } |
|
983 | ||
984 | public function testResolveTranslationDomainWithoutRequest() |
|
985 | { |
|
@@ 1082-1096 (lines=15) @@ | ||
1079 | $this->assertEmpty($this->parameterResolver->resolveValidationGroups()); |
|
1080 | } |
|
1081 | ||
1082 | public function testResolveValidationGroupsDefault() |
|
1083 | { |
|
1084 | $this->requestStack |
|
1085 | ->expects($this->once()) |
|
1086 | ->method('getMasterRequest') |
|
1087 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
1088 | ||
1089 | $request->attributes |
|
1090 | ->expects($this->once()) |
|
1091 | ->method('get') |
|
1092 | ->with($this->identicalTo('_lug_validation_groups'), $this->identicalTo($groups = [])) |
|
1093 | ->will($this->returnValue($groups)); |
|
1094 | ||
1095 | $this->assertEmpty($this->parameterResolver->resolveValidationGroups()); |
|
1096 | } |
|
1097 | ||
1098 | public function testResolveValidationGroupsExplicit() |
|
1099 | { |
|
@@ 1098-1112 (lines=15) @@ | ||
1095 | $this->assertEmpty($this->parameterResolver->resolveValidationGroups()); |
|
1096 | } |
|
1097 | ||
1098 | public function testResolveValidationGroupsExplicit() |
|
1099 | { |
|
1100 | $this->requestStack |
|
1101 | ->expects($this->once()) |
|
1102 | ->method('getMasterRequest') |
|
1103 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
1104 | ||
1105 | $request->attributes |
|
1106 | ->expects($this->once()) |
|
1107 | ->method('get') |
|
1108 | ->with($this->identicalTo('_lug_validation_groups'), $this->identicalTo([])) |
|
1109 | ->will($this->returnValue($groups = ['group'])); |
|
1110 | ||
1111 | $this->assertSame($groups, $this->parameterResolver->resolveValidationGroups()); |
|
1112 | } |
|
1113 | ||
1114 | /** |
|
1115 | * @return \PHPUnit_Framework_MockObject_MockObject|RequestStack |