|
@@ 224-238 (lines=15) @@
|
| 221 |
|
$this->assertSame(1, $this->parameterResolver->resolveCurrentPage()); |
| 222 |
|
} |
| 223 |
|
|
| 224 |
|
public function testResolveCurrentPageDefault() |
| 225 |
|
{ |
| 226 |
|
$this->requestStack |
| 227 |
|
->expects($this->once()) |
| 228 |
|
->method('getMasterRequest') |
| 229 |
|
->will($this->returnValue($request = $this->createRequestMock())); |
| 230 |
|
|
| 231 |
|
$request |
| 232 |
|
->expects($this->once()) |
| 233 |
|
->method('get') |
| 234 |
|
->with($this->identicalTo('page'), $this->identicalTo($page = 1)) |
| 235 |
|
->will($this->returnValue($page)); |
| 236 |
|
|
| 237 |
|
$this->assertSame($page, $this->parameterResolver->resolveCurrentPage()); |
| 238 |
|
} |
| 239 |
|
|
| 240 |
|
public function testResolveCurrentPageExplicit() |
| 241 |
|
{ |
|
@@ 240-254 (lines=15) @@
|
| 237 |
|
$this->assertSame($page, $this->parameterResolver->resolveCurrentPage()); |
| 238 |
|
} |
| 239 |
|
|
| 240 |
|
public function testResolveCurrentPageExplicit() |
| 241 |
|
{ |
| 242 |
|
$this->requestStack |
| 243 |
|
->expects($this->once()) |
| 244 |
|
->method('getMasterRequest') |
| 245 |
|
->will($this->returnValue($request = $this->createRequestMock())); |
| 246 |
|
|
| 247 |
|
$request |
| 248 |
|
->expects($this->once()) |
| 249 |
|
->method('get') |
| 250 |
|
->with($this->identicalTo('page'), $this->identicalTo(1)) |
| 251 |
|
->will($this->returnValue($page = 2)); |
| 252 |
|
|
| 253 |
|
$this->assertSame($page, $this->parameterResolver->resolveCurrentPage()); |
| 254 |
|
} |
| 255 |
|
|
| 256 |
|
public function testResolveFormWithoutRequest() |
| 257 |
|
{ |
|
@@ 697-711 (lines=15) @@
|
| 694 |
|
); |
| 695 |
|
} |
| 696 |
|
|
| 697 |
|
public function testResolveRedirectRouteParametersWithoutObject() |
| 698 |
|
{ |
| 699 |
|
$this->requestStack |
| 700 |
|
->expects($this->once()) |
| 701 |
|
->method('getMasterRequest') |
| 702 |
|
->will($this->returnValue($request = $this->createRequestMock())); |
| 703 |
|
|
| 704 |
|
$request->attributes |
| 705 |
|
->expects($this->once()) |
| 706 |
|
->method('get') |
| 707 |
|
->with($this->identicalTo('_lug_redirect_route_parameters'), $this->identicalTo([])) |
| 708 |
|
->will($this->returnValue([])); |
| 709 |
|
|
| 710 |
|
$this->assertEmpty($this->parameterResolver->resolveRedirectRouteParameters()); |
| 711 |
|
} |
| 712 |
|
|
| 713 |
|
/** |
| 714 |
|
* @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException |
|
@@ 717-731 (lines=15) @@
|
| 714 |
|
* @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException |
| 715 |
|
* @expectedExceptionMessage The route parameters could not be found for the route "redirect_route_parameters". |
| 716 |
|
*/ |
| 717 |
|
public function testResolveRedirectRouteParametersWithObjectMissing() |
| 718 |
|
{ |
| 719 |
|
$this->requestStack |
| 720 |
|
->expects($this->once()) |
| 721 |
|
->method('getMasterRequest') |
| 722 |
|
->will($this->returnValue($request = $this->createRequestMock())); |
| 723 |
|
|
| 724 |
|
$request->attributes |
| 725 |
|
->expects($this->once()) |
| 726 |
|
->method('get') |
| 727 |
|
->with($this->identicalTo('_lug_redirect_route_parameters'), $this->identicalTo([])) |
| 728 |
|
->will($this->returnValue(['id'])); |
| 729 |
|
|
| 730 |
|
$this->assertEmpty($this->parameterResolver->resolveRedirectRouteParameters()); |
| 731 |
|
} |
| 732 |
|
|
| 733 |
|
public function testResolveRedirectRouteParametersForwardWithoutRequest() |
| 734 |
|
{ |
|
@@ 812-826 (lines=15) @@
|
| 809 |
|
$this->assertEmpty($this->parameterResolver->resolveSerializerGroups()); |
| 810 |
|
} |
| 811 |
|
|
| 812 |
|
public function testResolveSerializerGroupsDefault() |
| 813 |
|
{ |
| 814 |
|
$this->requestStack |
| 815 |
|
->expects($this->once()) |
| 816 |
|
->method('getMasterRequest') |
| 817 |
|
->will($this->returnValue($request = $this->createRequestMock())); |
| 818 |
|
|
| 819 |
|
$request->attributes |
| 820 |
|
->expects($this->once()) |
| 821 |
|
->method('get') |
| 822 |
|
->with( |
| 823 |
|
$this->identicalTo('_lug_serializer_groups'), |
| 824 |
|
$this->identicalTo($groups = []) |
| 825 |
|
) |
| 826 |
|
->will($this->returnValue($groups)); |
| 827 |
|
|
| 828 |
|
$this->assertEmpty($this->parameterResolver->resolveSerializerGroups()); |
| 829 |
|
} |
|
@@ 892-906 (lines=15) @@
|
| 889 |
|
$this->assertEmpty($this->parameterResolver->resolveSorting()); |
| 890 |
|
} |
| 891 |
|
|
| 892 |
|
public function testResolveSortingDefault() |
| 893 |
|
{ |
| 894 |
|
$this->requestStack |
| 895 |
|
->expects($this->once()) |
| 896 |
|
->method('getMasterRequest') |
| 897 |
|
->will($this->returnValue($request = $this->createRequestMock())); |
| 898 |
|
|
| 899 |
|
$request->attributes |
| 900 |
|
->expects($this->once()) |
| 901 |
|
->method('get') |
| 902 |
|
->with($this->identicalTo('_lug_sorting'), $this->identicalTo($sorting = [])) |
| 903 |
|
->will($this->returnValue($sorting)); |
| 904 |
|
|
| 905 |
|
$this->assertEmpty($this->parameterResolver->resolveSorting()); |
| 906 |
|
} |
| 907 |
|
|
| 908 |
|
public function testResolveSortingExplicit() |
| 909 |
|
{ |
|
@@ 908-922 (lines=15) @@
|
| 905 |
|
$this->assertEmpty($this->parameterResolver->resolveSorting()); |
| 906 |
|
} |
| 907 |
|
|
| 908 |
|
public function testResolveSortingExplicit() |
| 909 |
|
{ |
| 910 |
|
$this->requestStack |
| 911 |
|
->expects($this->once()) |
| 912 |
|
->method('getMasterRequest') |
| 913 |
|
->will($this->returnValue($request = $this->createRequestMock())); |
| 914 |
|
|
| 915 |
|
$request->attributes |
| 916 |
|
->expects($this->once()) |
| 917 |
|
->method('get') |
| 918 |
|
->with($this->identicalTo('_lug_sorting'), $this->identicalTo([])) |
| 919 |
|
->will($this->returnValue($sorting = ['foo' => 'ASC'])); |
| 920 |
|
|
| 921 |
|
$this->assertSame($sorting, $this->parameterResolver->resolveSorting()); |
| 922 |
|
} |
| 923 |
|
|
| 924 |
|
public function testResolveStatusCodeWithoutRequest() |
| 925 |
|
{ |
|
@@ 929-943 (lines=15) @@
|
| 926 |
|
$this->assertSame($statusCode = 200, $this->parameterResolver->resolveStatusCode($statusCode)); |
| 927 |
|
} |
| 928 |
|
|
| 929 |
|
public function testResolveStatusCodeDefault() |
| 930 |
|
{ |
| 931 |
|
$this->requestStack |
| 932 |
|
->expects($this->once()) |
| 933 |
|
->method('getMasterRequest') |
| 934 |
|
->will($this->returnValue($request = $this->createRequestMock())); |
| 935 |
|
|
| 936 |
|
$request->attributes |
| 937 |
|
->expects($this->once()) |
| 938 |
|
->method('get') |
| 939 |
|
->with($this->identicalTo('_lug_status_code'), $this->identicalTo($statusCode = 200)) |
| 940 |
|
->will($this->returnValue($statusCode)); |
| 941 |
|
|
| 942 |
|
$this->assertSame($statusCode, $this->parameterResolver->resolveStatusCode($statusCode)); |
| 943 |
|
} |
| 944 |
|
|
| 945 |
|
public function testResolveStatusCodeExplicit() |
| 946 |
|
{ |
|
@@ 1017-1031 (lines=15) @@
|
| 1014 |
|
$this->assertEmpty($this->parameterResolver->resolveThemes()); |
| 1015 |
|
} |
| 1016 |
|
|
| 1017 |
|
public function testResolveThemesDefault() |
| 1018 |
|
{ |
| 1019 |
|
$this->requestStack |
| 1020 |
|
->expects($this->once()) |
| 1021 |
|
->method('getMasterRequest') |
| 1022 |
|
->will($this->returnValue($request = $this->createRequestMock())); |
| 1023 |
|
|
| 1024 |
|
$request->attributes |
| 1025 |
|
->expects($this->once()) |
| 1026 |
|
->method('get') |
| 1027 |
|
->with($this->identicalTo('_lug_themes'), $this->identicalTo($themes = [])) |
| 1028 |
|
->will($this->returnValue($themes)); |
| 1029 |
|
|
| 1030 |
|
$this->assertEmpty($this->parameterResolver->resolveThemes()); |
| 1031 |
|
} |
| 1032 |
|
|
| 1033 |
|
public function testResolveThemesExplicit() |
| 1034 |
|
{ |
|
@@ 1033-1047 (lines=15) @@
|
| 1030 |
|
$this->assertEmpty($this->parameterResolver->resolveThemes()); |
| 1031 |
|
} |
| 1032 |
|
|
| 1033 |
|
public function testResolveThemesExplicit() |
| 1034 |
|
{ |
| 1035 |
|
$this->requestStack |
| 1036 |
|
->expects($this->once()) |
| 1037 |
|
->method('getMasterRequest') |
| 1038 |
|
->will($this->returnValue($request = $this->createRequestMock())); |
| 1039 |
|
|
| 1040 |
|
$request->attributes |
| 1041 |
|
->expects($this->once()) |
| 1042 |
|
->method('get') |
| 1043 |
|
->with($this->identicalTo('_lug_themes'), $this->identicalTo([])) |
| 1044 |
|
->will($this->returnValue($themes = ['theme'])); |
| 1045 |
|
|
| 1046 |
|
$this->assertSame($themes, $this->parameterResolver->resolveThemes()); |
| 1047 |
|
} |
| 1048 |
|
|
| 1049 |
|
public function testResolveTranslationDomainWithoutRequest() |
| 1050 |
|
{ |
|
@@ 1147-1161 (lines=15) @@
|
| 1144 |
|
$this->assertEmpty($this->parameterResolver->resolveValidationGroups()); |
| 1145 |
|
} |
| 1146 |
|
|
| 1147 |
|
public function testResolveValidationGroupsDefault() |
| 1148 |
|
{ |
| 1149 |
|
$this->requestStack |
| 1150 |
|
->expects($this->once()) |
| 1151 |
|
->method('getMasterRequest') |
| 1152 |
|
->will($this->returnValue($request = $this->createRequestMock())); |
| 1153 |
|
|
| 1154 |
|
$request->attributes |
| 1155 |
|
->expects($this->once()) |
| 1156 |
|
->method('get') |
| 1157 |
|
->with($this->identicalTo('_lug_validation_groups'), $this->identicalTo($groups = [])) |
| 1158 |
|
->will($this->returnValue($groups)); |
| 1159 |
|
|
| 1160 |
|
$this->assertEmpty($this->parameterResolver->resolveValidationGroups()); |
| 1161 |
|
} |
| 1162 |
|
|
| 1163 |
|
public function testResolveValidationGroupsExplicit() |
| 1164 |
|
{ |
|
@@ 1163-1177 (lines=15) @@
|
| 1160 |
|
$this->assertEmpty($this->parameterResolver->resolveValidationGroups()); |
| 1161 |
|
} |
| 1162 |
|
|
| 1163 |
|
public function testResolveValidationGroupsExplicit() |
| 1164 |
|
{ |
| 1165 |
|
$this->requestStack |
| 1166 |
|
->expects($this->once()) |
| 1167 |
|
->method('getMasterRequest') |
| 1168 |
|
->will($this->returnValue($request = $this->createRequestMock())); |
| 1169 |
|
|
| 1170 |
|
$request->attributes |
| 1171 |
|
->expects($this->once()) |
| 1172 |
|
->method('get') |
| 1173 |
|
->with($this->identicalTo('_lug_validation_groups'), $this->identicalTo([])) |
| 1174 |
|
->will($this->returnValue($groups = ['group'])); |
| 1175 |
|
|
| 1176 |
|
$this->assertSame($groups, $this->parameterResolver->resolveValidationGroups()); |
| 1177 |
|
} |
| 1178 |
|
|
| 1179 |
|
public function testResolveVoterWithoutRequest() |
| 1180 |
|
{ |