Code Duplication    Length = 21-21 lines in 6 locations

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

@@ 522-542 (lines=21) @@
519
        $this->assertSame($maxPerPage, $this->parameterResolver->resolveMaxPerPage());
520
    }
521
522
    public function testResolveMaxPerPageDynamic()
523
    {
524
        $this->requestStack
525
            ->expects($this->exactly(2))
526
            ->method('getMasterRequest')
527
            ->will($this->returnValue($request = $this->createRequestMock()));
528
529
        $request->attributes
530
            ->expects($this->once())
531
            ->method('get')
532
            ->with($this->identicalTo('_lug_max_per_page'), $this->identicalTo(10))
533
            ->will($this->returnValue(10));
534
535
        $request
536
            ->expects($this->once())
537
            ->method('get')
538
            ->with($this->identicalTo('limit'), $this->identicalTo(10))
539
            ->will($this->returnValue($maxPerPage = 20));
540
541
        $this->assertSame($maxPerPage, $this->parameterResolver->resolveMaxPerPage());
542
    }
543
544
    public function testResolveMaxPerPageTooBig()
545
    {
@@ 544-564 (lines=21) @@
541
        $this->assertSame($maxPerPage, $this->parameterResolver->resolveMaxPerPage());
542
    }
543
544
    public function testResolveMaxPerPageTooBig()
545
    {
546
        $this->requestStack
547
            ->expects($this->exactly(2))
548
            ->method('getMasterRequest')
549
            ->will($this->returnValue($request = $this->createRequestMock()));
550
551
        $request->attributes
552
            ->expects($this->once())
553
            ->method('get')
554
            ->with($this->identicalTo('_lug_max_per_page'), $this->identicalTo(10))
555
            ->will($this->returnValue(10));
556
557
        $request
558
            ->expects($this->once())
559
            ->method('get')
560
            ->with($this->identicalTo('limit'), $this->identicalTo(10))
561
            ->will($this->returnValue(101));
562
563
        $this->assertSame(100, $this->parameterResolver->resolveMaxPerPage());
564
    }
565
566
    public function testResolveRedirectRoute()
567
    {
@@ 1054-1074 (lines=21) @@
1051
        $this->assertSame('forms', $this->parameterResolver->resolveTranslationDomain());
1052
    }
1053
1054
    public function testResolveTranslationDomainDefault()
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($translationDomain = 'forms'))
1071
            ->will($this->returnValue($translationDomain));
1072
1073
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1074
    }
1075
1076
    public function testResolveTranslationDomainExplicit()
1077
    {
@@ 1076-1096 (lines=21) @@
1073
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1074
    }
1075
1076
    public function testResolveTranslationDomainExplicit()
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(null));
1088
1089
        $request->attributes
1090
            ->expects($this->at(1))
1091
            ->method('get')
1092
            ->with($this->identicalTo('_lug_translation_domain'), $this->identicalTo('forms'))
1093
            ->will($this->returnValue($translationDomain = 'translation_domain'));
1094
1095
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1096
    }
1097
1098
    public function testResolveTranslationDomainWithGrid()
1099
    {
@@ 1098-1118 (lines=21) @@
1095
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1096
    }
1097
1098
    public function testResolveTranslationDomainWithGrid()
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($translationDomain = 'grids'))
1115
            ->will($this->returnValue($translationDomain));
1116
1117
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1118
    }
1119
1120
    public function testResolveTranslationDomainExplicitWithGrid()
1121
    {
@@ 1120-1140 (lines=21) @@
1117
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1118
    }
1119
1120
    public function testResolveTranslationDomainExplicitWithGrid()
1121
    {
1122
        $this->requestStack
1123
            ->expects($this->exactly(2))
1124
            ->method('getMasterRequest')
1125
            ->will($this->returnValue($request = $this->createRequestMock()));
1126
1127
        $request->attributes
1128
            ->expects($this->at(0))
1129
            ->method('get')
1130
            ->with($this->identicalTo('_lug_grid'), $this->isNull())
1131
            ->will($this->returnValue(['grid']));
1132
1133
        $request->attributes
1134
            ->expects($this->at(1))
1135
            ->method('get')
1136
            ->with($this->identicalTo('_lug_translation_domain'), $this->identicalTo('grids'))
1137
            ->will($this->returnValue($translationDomain = 'translation_domain'));
1138
1139
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1140
    }
1141
1142
    public function testResolveValidationGroupsWithoutRequest()
1143
    {