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
    {
@@ 995-1015 (lines=21) @@
992
        $this->assertSame('forms', $this->parameterResolver->resolveTranslationDomain());
993
    }
994
995
    public function testResolveTranslationDomainDefault()
996
    {
997
        $this->requestStack
998
            ->expects($this->exactly(2))
999
            ->method('getMasterRequest')
1000
            ->will($this->returnValue($request = $this->createRequestMock()));
1001
1002
        $request->attributes
1003
            ->expects($this->at(0))
1004
            ->method('get')
1005
            ->with($this->identicalTo('_lug_grid'), $this->isNull())
1006
            ->will($this->returnValue(null));
1007
1008
        $request->attributes
1009
            ->expects($this->at(1))
1010
            ->method('get')
1011
            ->with($this->identicalTo('_lug_translation_domain'), $this->identicalTo($translationDomain = 'forms'))
1012
            ->will($this->returnValue($translationDomain));
1013
1014
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1015
    }
1016
1017
    public function testResolveTranslationDomainExplicit()
1018
    {
@@ 1017-1037 (lines=21) @@
1014
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1015
    }
1016
1017
    public function testResolveTranslationDomainExplicit()
1018
    {
1019
        $this->requestStack
1020
            ->expects($this->exactly(2))
1021
            ->method('getMasterRequest')
1022
            ->will($this->returnValue($request = $this->createRequestMock()));
1023
1024
        $request->attributes
1025
            ->expects($this->at(0))
1026
            ->method('get')
1027
            ->with($this->identicalTo('_lug_grid'), $this->isNull())
1028
            ->will($this->returnValue(null));
1029
1030
        $request->attributes
1031
            ->expects($this->at(1))
1032
            ->method('get')
1033
            ->with($this->identicalTo('_lug_translation_domain'), $this->identicalTo('forms'))
1034
            ->will($this->returnValue($translationDomain = 'translation_domain'));
1035
1036
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1037
    }
1038
1039
    public function testResolveTranslationDomainWithGrid()
1040
    {
@@ 1039-1059 (lines=21) @@
1036
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1037
    }
1038
1039
    public function testResolveTranslationDomainWithGrid()
1040
    {
1041
        $this->requestStack
1042
            ->expects($this->exactly(2))
1043
            ->method('getMasterRequest')
1044
            ->will($this->returnValue($request = $this->createRequestMock()));
1045
1046
        $request->attributes
1047
            ->expects($this->at(0))
1048
            ->method('get')
1049
            ->with($this->identicalTo('_lug_grid'), $this->isNull())
1050
            ->will($this->returnValue(['grid']));
1051
1052
        $request->attributes
1053
            ->expects($this->at(1))
1054
            ->method('get')
1055
            ->with($this->identicalTo('_lug_translation_domain'), $this->identicalTo($translationDomain = 'grids'))
1056
            ->will($this->returnValue($translationDomain));
1057
1058
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1059
    }
1060
1061
    public function testResolveTranslationDomainExplicitWithGrid()
1062
    {
@@ 1061-1081 (lines=21) @@
1058
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1059
    }
1060
1061
    public function testResolveTranslationDomainExplicitWithGrid()
1062
    {
1063
        $this->requestStack
1064
            ->expects($this->exactly(2))
1065
            ->method('getMasterRequest')
1066
            ->will($this->returnValue($request = $this->createRequestMock()));
1067
1068
        $request->attributes
1069
            ->expects($this->at(0))
1070
            ->method('get')
1071
            ->with($this->identicalTo('_lug_grid'), $this->isNull())
1072
            ->will($this->returnValue(['grid']));
1073
1074
        $request->attributes
1075
            ->expects($this->at(1))
1076
            ->method('get')
1077
            ->with($this->identicalTo('_lug_translation_domain'), $this->identicalTo('grids'))
1078
            ->will($this->returnValue($translationDomain = 'translation_domain'));
1079
1080
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1081
    }
1082
1083
    public function testResolveValidationGroupsWithoutRequest()
1084
    {