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 testResolveMaxPerPageLowerThan0()
545
    {
@@ 566-586 (lines=21) @@
563
        $this->assertSame($default, $this->parameterResolver->resolveMaxPerPage());
564
    }
565
566
    public function testResolveMaxPerPageUpperThan100()
567
    {
568
        $this->requestStack
569
            ->expects($this->exactly(2))
570
            ->method('getMasterRequest')
571
            ->will($this->returnValue($request = $this->createRequestMock()));
572
573
        $request->attributes
574
            ->expects($this->once())
575
            ->method('get')
576
            ->with($this->identicalTo('_lug_max_per_page'), $this->identicalTo(10))
577
            ->will($this->returnValue(10));
578
579
        $request
580
            ->expects($this->once())
581
            ->method('get')
582
            ->with($this->identicalTo('limit'), $this->identicalTo(10))
583
            ->will($this->returnValue(101));
584
585
        $this->assertSame(100, $this->parameterResolver->resolveMaxPerPage());
586
    }
587
588
    public function testResolveRedirectRoute()
589
    {
@@ 1076-1096 (lines=21) @@
1073
        $this->assertSame('forms', $this->parameterResolver->resolveTranslationDomain());
1074
    }
1075
1076
    public function testResolveTranslationDomainDefault()
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($translationDomain = 'forms'))
1093
            ->will($this->returnValue($translationDomain));
1094
1095
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1096
    }
1097
1098
    public function testResolveTranslationDomainExplicit()
1099
    {
@@ 1098-1118 (lines=21) @@
1095
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1096
    }
1097
1098
    public function testResolveTranslationDomainExplicit()
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(null));
1110
1111
        $request->attributes
1112
            ->expects($this->at(1))
1113
            ->method('get')
1114
            ->with($this->identicalTo('_lug_translation_domain'), $this->identicalTo('forms'))
1115
            ->will($this->returnValue($translationDomain = 'translation_domain'));
1116
1117
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1118
    }
1119
1120
    public function testResolveTranslationDomainWithGrid()
1121
    {
@@ 1120-1140 (lines=21) @@
1117
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1118
    }
1119
1120
    public function testResolveTranslationDomainWithGrid()
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($translationDomain = 'grids'))
1137
            ->will($this->returnValue($translationDomain));
1138
1139
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1140
    }
1141
1142
    public function testResolveTranslationDomainExplicitWithGrid()
1143
    {
@@ 1142-1162 (lines=21) @@
1139
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1140
    }
1141
1142
    public function testResolveTranslationDomainExplicitWithGrid()
1143
    {
1144
        $this->requestStack
1145
            ->expects($this->exactly(2))
1146
            ->method('getMasterRequest')
1147
            ->will($this->returnValue($request = $this->createRequestMock()));
1148
1149
        $request->attributes
1150
            ->expects($this->at(0))
1151
            ->method('get')
1152
            ->with($this->identicalTo('_lug_grid'), $this->isNull())
1153
            ->will($this->returnValue(['grid']));
1154
1155
        $request->attributes
1156
            ->expects($this->at(1))
1157
            ->method('get')
1158
            ->with($this->identicalTo('_lug_translation_domain'), $this->identicalTo('grids'))
1159
            ->will($this->returnValue($translationDomain = 'translation_domain'));
1160
1161
        $this->assertSame($translationDomain, $this->parameterResolver->resolveTranslationDomain());
1162
    }
1163
1164
    public function testResolveValidationGroupsWithoutRequest()
1165
    {