@@ 246-266 (lines=21) @@ | ||
243 | $this->assertSame($page, $this->parameterResolver->resolveCurrentPage()); |
|
244 | } |
|
245 | ||
246 | public function testResolveCurrentPageExplicitParameter() |
|
247 | { |
|
248 | $this->requestStack |
|
249 | ->expects($this->exactly(2)) |
|
250 | ->method('getMasterRequest') |
|
251 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
252 | ||
253 | $request->attributes |
|
254 | ->expects($this->once()) |
|
255 | ->method('get') |
|
256 | ->with($this->identicalTo('_lug_page_parameter'), $this->identicalTo('page')) |
|
257 | ->will($this->returnValue($pageParameter = 'p')); |
|
258 | ||
259 | $request |
|
260 | ->expects($this->once()) |
|
261 | ->method('get') |
|
262 | ->with($this->identicalTo($pageParameter), $this->identicalTo($page = 1)) |
|
263 | ->will($this->returnValue($page)); |
|
264 | ||
265 | $this->assertSame($page, $this->parameterResolver->resolveCurrentPage()); |
|
266 | } |
|
267 | ||
268 | public function testResolveCurrentPageExplicitPage() |
|
269 | { |
|
@@ 268-288 (lines=21) @@ | ||
265 | $this->assertSame($page, $this->parameterResolver->resolveCurrentPage()); |
|
266 | } |
|
267 | ||
268 | public function testResolveCurrentPageExplicitPage() |
|
269 | { |
|
270 | $this->requestStack |
|
271 | ->expects($this->exactly(2)) |
|
272 | ->method('getMasterRequest') |
|
273 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
274 | ||
275 | $request->attributes |
|
276 | ->expects($this->once()) |
|
277 | ->method('get') |
|
278 | ->with($this->identicalTo('_lug_page_parameter'), $this->identicalTo($pageParameter = 'page')) |
|
279 | ->will($this->returnValue($pageParameter)); |
|
280 | ||
281 | $request |
|
282 | ->expects($this->once()) |
|
283 | ->method('get') |
|
284 | ->with($this->identicalTo($pageParameter), $this->identicalTo(1)) |
|
285 | ->will($this->returnValue($page = 2)); |
|
286 | ||
287 | $this->assertSame($page, $this->parameterResolver->resolveCurrentPage()); |
|
288 | } |
|
289 | ||
290 | public function testResolveFormWithoutRequest() |
|
291 | { |
|
@@ 989-1009 (lines=21) @@ | ||
986 | $this->assertSame('forms', $this->parameterResolver->resolveTranslationDomain()); |
|
987 | } |
|
988 | ||
989 | public function testResolveTranslationDomainDefault() |
|
990 | { |
|
991 | $this->requestStack |
|
992 | ->expects($this->exactly(2)) |
|
993 | ->method('getMasterRequest') |
|
994 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
995 | ||
996 | $request->attributes |
|
997 | ->expects($this->at(0)) |
|
998 | ->method('get') |
|
999 | ->with($this->identicalTo('_lug_grid'), $this->isNull()) |
|
1000 | ->will($this->returnValue(null)); |
|
1001 | ||
1002 | $request->attributes |
|
1003 | ->expects($this->at(1)) |
|
1004 | ->method('get') |
|
1005 | ->with($this->identicalTo('_lug_translation_domain'), $this->identicalTo($translationDomain = 'forms')) |
|
1006 | ->will($this->returnValue($translationDomain)); |
|
1007 | ||
1008 | $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain()); |
|
1009 | } |
|
1010 | ||
1011 | public function testResolveTranslationDomainExplicit() |
|
1012 | { |
|
@@ 1011-1031 (lines=21) @@ | ||
1008 | $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain()); |
|
1009 | } |
|
1010 | ||
1011 | public function testResolveTranslationDomainExplicit() |
|
1012 | { |
|
1013 | $this->requestStack |
|
1014 | ->expects($this->exactly(2)) |
|
1015 | ->method('getMasterRequest') |
|
1016 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
1017 | ||
1018 | $request->attributes |
|
1019 | ->expects($this->at(0)) |
|
1020 | ->method('get') |
|
1021 | ->with($this->identicalTo('_lug_grid'), $this->isNull()) |
|
1022 | ->will($this->returnValue(null)); |
|
1023 | ||
1024 | $request->attributes |
|
1025 | ->expects($this->at(1)) |
|
1026 | ->method('get') |
|
1027 | ->with($this->identicalTo('_lug_translation_domain'), $this->identicalTo('forms')) |
|
1028 | ->will($this->returnValue($translationDomain = 'translation_domain')); |
|
1029 | ||
1030 | $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain()); |
|
1031 | } |
|
1032 | ||
1033 | public function testResolveTranslationDomainWithGrid() |
|
1034 | { |
|
@@ 1033-1053 (lines=21) @@ | ||
1030 | $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain()); |
|
1031 | } |
|
1032 | ||
1033 | public function testResolveTranslationDomainWithGrid() |
|
1034 | { |
|
1035 | $this->requestStack |
|
1036 | ->expects($this->exactly(2)) |
|
1037 | ->method('getMasterRequest') |
|
1038 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
1039 | ||
1040 | $request->attributes |
|
1041 | ->expects($this->at(0)) |
|
1042 | ->method('get') |
|
1043 | ->with($this->identicalTo('_lug_grid'), $this->isNull()) |
|
1044 | ->will($this->returnValue(['grid'])); |
|
1045 | ||
1046 | $request->attributes |
|
1047 | ->expects($this->at(1)) |
|
1048 | ->method('get') |
|
1049 | ->with($this->identicalTo('_lug_translation_domain'), $this->identicalTo($translationDomain = 'grids')) |
|
1050 | ->will($this->returnValue($translationDomain)); |
|
1051 | ||
1052 | $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain()); |
|
1053 | } |
|
1054 | ||
1055 | public function testResolveTranslationDomainExplicitWithGrid() |
|
1056 | { |
|
@@ 1055-1075 (lines=21) @@ | ||
1052 | $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain()); |
|
1053 | } |
|
1054 | ||
1055 | public function testResolveTranslationDomainExplicitWithGrid() |
|
1056 | { |
|
1057 | $this->requestStack |
|
1058 | ->expects($this->exactly(2)) |
|
1059 | ->method('getMasterRequest') |
|
1060 | ->will($this->returnValue($request = $this->createRequestMock())); |
|
1061 | ||
1062 | $request->attributes |
|
1063 | ->expects($this->at(0)) |
|
1064 | ->method('get') |
|
1065 | ->with($this->identicalTo('_lug_grid'), $this->isNull()) |
|
1066 | ->will($this->returnValue(['grid'])); |
|
1067 | ||
1068 | $request->attributes |
|
1069 | ->expects($this->at(1)) |
|
1070 | ->method('get') |
|
1071 | ->with($this->identicalTo('_lug_translation_domain'), $this->identicalTo('grids')) |
|
1072 | ->will($this->returnValue($translationDomain = 'translation_domain')); |
|
1073 | ||
1074 | $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain()); |
|
1075 | } |
|
1076 | ||
1077 | public function testResolveValidationGroupsWithoutRequest() |
|
1078 | { |