Code Duplication    Length = 21-21 lines in 6 locations

src/Bundle/ResourceBundle/Tests/Routing/ParameterResolverTest.php 6 locations

@@ 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
    {
@@ 1032-1052 (lines=21) @@
1029
        $this->assertSame('forms', $this->parameterResolver->resolveTranslationDomain());
1030
    }
1031
1032
    public function testResolveTranslationDomainDefault()
1033
    {
1034
        $this->requestStack
1035
            ->expects($this->exactly(2))
1036
            ->method('getMasterRequest')
1037
            ->will($this->returnValue($request = $this->createRequestMock()));
1038
1039
        $request->attributes
1040
            ->expects($this->at(0))
1041
            ->method('get')
1042
            ->with($this->identicalTo('_lug_grid'), $this->isNull())
1043
            ->will($this->returnValue(null));
1044
1045
        $request->attributes
1046
            ->expects($this->at(1))
1047
            ->method('get')
1048
            ->with($this->identicalTo('_lug_translation_domain'), $this->identicalTo($translationDomain = 'forms'))
1049
            ->will($this->returnValue($translationDomain));
1050
1051
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1052
    }
1053
1054
    public function testResolveTranslationDomainExplicit()
1055
    {
@@ 1054-1074 (lines=21) @@
1051
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1052
    }
1053
1054
    public function testResolveTranslationDomainExplicit()
1055
    {
1056
        $this->requestStack
1057
            ->expects($this->exactly(2))
1058
            ->method('getMasterRequest')
1059
            ->will($this->returnValue($request = $this->createRequestMock()));
1060
1061
        $request->attributes
1062
            ->expects($this->at(0))
1063
            ->method('get')
1064
            ->with($this->identicalTo('_lug_grid'), $this->isNull())
1065
            ->will($this->returnValue(null));
1066
1067
        $request->attributes
1068
            ->expects($this->at(1))
1069
            ->method('get')
1070
            ->with($this->identicalTo('_lug_translation_domain'), $this->identicalTo('forms'))
1071
            ->will($this->returnValue($translationDomain = 'translation_domain'));
1072
1073
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1074
    }
1075
1076
    public function testResolveTranslationDomainWithGrid()
1077
    {
@@ 1076-1096 (lines=21) @@
1073
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1074
    }
1075
1076
    public function testResolveTranslationDomainWithGrid()
1077
    {
1078
        $this->requestStack
1079
            ->expects($this->exactly(2))
1080
            ->method('getMasterRequest')
1081
            ->will($this->returnValue($request = $this->createRequestMock()));
1082
1083
        $request->attributes
1084
            ->expects($this->at(0))
1085
            ->method('get')
1086
            ->with($this->identicalTo('_lug_grid'), $this->isNull())
1087
            ->will($this->returnValue(['grid']));
1088
1089
        $request->attributes
1090
            ->expects($this->at(1))
1091
            ->method('get')
1092
            ->with($this->identicalTo('_lug_translation_domain'), $this->identicalTo($translationDomain = 'grids'))
1093
            ->will($this->returnValue($translationDomain));
1094
1095
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1096
    }
1097
1098
    public function testResolveTranslationDomainExplicitWithGrid()
1099
    {
@@ 1098-1118 (lines=21) @@
1095
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1096
    }
1097
1098
    public function testResolveTranslationDomainExplicitWithGrid()
1099
    {
1100
        $this->requestStack
1101
            ->expects($this->exactly(2))
1102
            ->method('getMasterRequest')
1103
            ->will($this->returnValue($request = $this->createRequestMock()));
1104
1105
        $request->attributes
1106
            ->expects($this->at(0))
1107
            ->method('get')
1108
            ->with($this->identicalTo('_lug_grid'), $this->isNull())
1109
            ->will($this->returnValue(['grid']));
1110
1111
        $request->attributes
1112
            ->expects($this->at(1))
1113
            ->method('get')
1114
            ->with($this->identicalTo('_lug_translation_domain'), $this->identicalTo('grids'))
1115
            ->will($this->returnValue($translationDomain = 'translation_domain'));
1116
1117
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1118
    }
1119
1120
    public function testResolveValidationGroupsWithoutRequest()
1121
    {