Code Duplication    Length = 21-21 lines in 6 locations

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

@@ 248-268 (lines=21) @@
245
        $this->assertSame($page, $this->parameterResolver->resolveCurrentPage());
246
    }
247
248
    public function testResolveCurrentPageExplicitParameter()
249
    {
250
        $this->requestStack
251
            ->expects($this->exactly(2))
252
            ->method('getMasterRequest')
253
            ->will($this->returnValue($request = $this->createRequestMock()));
254
255
        $request->attributes
256
            ->expects($this->once())
257
            ->method('get')
258
            ->with($this->identicalTo('_lug_page_parameter'), $this->identicalTo('page'))
259
            ->will($this->returnValue($pageParameter = 'p'));
260
261
        $request
262
            ->expects($this->once())
263
            ->method('get')
264
            ->with($this->identicalTo($pageParameter), $this->identicalTo($page = 1))
265
            ->will($this->returnValue($page));
266
267
        $this->assertSame($page, $this->parameterResolver->resolveCurrentPage());
268
    }
269
270
    public function testResolveCurrentPageExplicitPage()
271
    {
@@ 270-290 (lines=21) @@
267
        $this->assertSame($page, $this->parameterResolver->resolveCurrentPage());
268
    }
269
270
    public function testResolveCurrentPageExplicitPage()
271
    {
272
        $this->requestStack
273
            ->expects($this->exactly(2))
274
            ->method('getMasterRequest')
275
            ->will($this->returnValue($request = $this->createRequestMock()));
276
277
        $request->attributes
278
            ->expects($this->once())
279
            ->method('get')
280
            ->with($this->identicalTo('_lug_page_parameter'), $this->identicalTo($pageParameter = 'page'))
281
            ->will($this->returnValue($pageParameter));
282
283
        $request
284
            ->expects($this->once())
285
            ->method('get')
286
            ->with($this->identicalTo($pageParameter), $this->identicalTo(1))
287
            ->will($this->returnValue($page = 2));
288
289
        $this->assertSame($page, $this->parameterResolver->resolveCurrentPage());
290
    }
291
292
    public function testResolveFormWithoutRequest()
293
    {
@@ 1018-1038 (lines=21) @@
1015
        $this->assertSame('forms', $this->parameterResolver->resolveTranslationDomain());
1016
    }
1017
1018
    public function testResolveTranslationDomainDefault()
1019
    {
1020
        $this->requestStack
1021
            ->expects($this->exactly(2))
1022
            ->method('getMasterRequest')
1023
            ->will($this->returnValue($request = $this->createRequestMock()));
1024
1025
        $request->attributes
1026
            ->expects($this->at(0))
1027
            ->method('get')
1028
            ->with($this->identicalTo('_lug_grid'), $this->isNull())
1029
            ->will($this->returnValue(null));
1030
1031
        $request->attributes
1032
            ->expects($this->at(1))
1033
            ->method('get')
1034
            ->with($this->identicalTo('_lug_translation_domain'), $this->identicalTo($translationDomain = 'forms'))
1035
            ->will($this->returnValue($translationDomain));
1036
1037
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1038
    }
1039
1040
    public function testResolveTranslationDomainExplicit()
1041
    {
@@ 1040-1060 (lines=21) @@
1037
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1038
    }
1039
1040
    public function testResolveTranslationDomainExplicit()
1041
    {
1042
        $this->requestStack
1043
            ->expects($this->exactly(2))
1044
            ->method('getMasterRequest')
1045
            ->will($this->returnValue($request = $this->createRequestMock()));
1046
1047
        $request->attributes
1048
            ->expects($this->at(0))
1049
            ->method('get')
1050
            ->with($this->identicalTo('_lug_grid'), $this->isNull())
1051
            ->will($this->returnValue(null));
1052
1053
        $request->attributes
1054
            ->expects($this->at(1))
1055
            ->method('get')
1056
            ->with($this->identicalTo('_lug_translation_domain'), $this->identicalTo('forms'))
1057
            ->will($this->returnValue($translationDomain = 'translation_domain'));
1058
1059
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1060
    }
1061
1062
    public function testResolveTranslationDomainWithGrid()
1063
    {
@@ 1062-1082 (lines=21) @@
1059
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1060
    }
1061
1062
    public function testResolveTranslationDomainWithGrid()
1063
    {
1064
        $this->requestStack
1065
            ->expects($this->exactly(2))
1066
            ->method('getMasterRequest')
1067
            ->will($this->returnValue($request = $this->createRequestMock()));
1068
1069
        $request->attributes
1070
            ->expects($this->at(0))
1071
            ->method('get')
1072
            ->with($this->identicalTo('_lug_grid'), $this->isNull())
1073
            ->will($this->returnValue(['grid']));
1074
1075
        $request->attributes
1076
            ->expects($this->at(1))
1077
            ->method('get')
1078
            ->with($this->identicalTo('_lug_translation_domain'), $this->identicalTo($translationDomain = 'grids'))
1079
            ->will($this->returnValue($translationDomain));
1080
1081
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1082
    }
1083
1084
    public function testResolveTranslationDomainExplicitWithGrid()
1085
    {
@@ 1084-1104 (lines=21) @@
1081
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1082
    }
1083
1084
    public function testResolveTranslationDomainExplicitWithGrid()
1085
    {
1086
        $this->requestStack
1087
            ->expects($this->exactly(2))
1088
            ->method('getMasterRequest')
1089
            ->will($this->returnValue($request = $this->createRequestMock()));
1090
1091
        $request->attributes
1092
            ->expects($this->at(0))
1093
            ->method('get')
1094
            ->with($this->identicalTo('_lug_grid'), $this->isNull())
1095
            ->will($this->returnValue(['grid']));
1096
1097
        $request->attributes
1098
            ->expects($this->at(1))
1099
            ->method('get')
1100
            ->with($this->identicalTo('_lug_translation_domain'), $this->identicalTo('grids'))
1101
            ->will($this->returnValue($translationDomain = 'translation_domain'));
1102
1103
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1104
    }
1105
1106
    public function testResolveValidationGroupsWithoutRequest()
1107
    {