Code Duplication    Length = 21-21 lines in 4 locations

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

@@ 167-187 (lines=21) @@
164
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
165
     * @expectedExceptionMessage The criteria could not be found for the route "route".
166
     */
167
    public function testResolveCriteriaMandatoryWithoutCriteria()
168
    {
169
        $this->requestStack
170
            ->expects($this->exactly(2))
171
            ->method('getMasterRequest')
172
            ->will($this->returnValue($request = $this->createRequestMock()));
173
174
        $request->attributes
175
            ->expects($this->at(0))
176
            ->method('get')
177
            ->with($this->identicalTo('_lug_criteria'), $this->identicalTo(['id']))
178
            ->will($this->returnValue([]));
179
180
        $request->attributes
181
            ->expects($this->at(1))
182
            ->method('get')
183
            ->with($this->identicalTo('_route'), $this->isNull())
184
            ->will($this->returnValue('route'));
185
186
        $this->parameterResolver->resolveCriteria(true);
187
    }
188
189
    /**
190
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
@@ 441-461 (lines=21) @@
438
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
439
     * @expectedExceptionMessage The location route could not be found for the route "route".
440
     */
441
    public function testResolveLocationRouteMissing()
442
    {
443
        $this->requestStack
444
            ->expects($this->exactly(2))
445
            ->method('getMasterRequest')
446
            ->will($this->returnValue($request = $this->createRequestMock()));
447
448
        $request->attributes
449
            ->expects($this->at(0))
450
            ->method('get')
451
            ->with($this->identicalTo('_lug_location_route'), $this->isNull())
452
            ->will($this->returnValue(null));
453
454
        $request->attributes
455
            ->expects($this->at(1))
456
            ->method('get')
457
            ->with($this->identicalTo('_route'), $this->isNull())
458
            ->will($this->returnValue('route'));
459
460
        $this->parameterResolver->resolveLocationRoute();
461
    }
462
463
    public function testResolveLocationRouteParametersWithoutRequest()
464
    {
@@ 575-595 (lines=21) @@
572
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
573
     * @expectedExceptionMessage The redirect route could not be found for the route "route".
574
     */
575
    public function testResolveRedirectRouteMissing()
576
    {
577
        $this->requestStack
578
            ->expects($this->exactly(2))
579
            ->method('getMasterRequest')
580
            ->will($this->returnValue($request = $this->createRequestMock()));
581
582
        $request->attributes
583
            ->expects($this->at(0))
584
            ->method('get')
585
            ->with($this->identicalTo('_lug_redirect_route'), $this->isNull())
586
            ->will($this->returnValue(null));
587
588
        $request->attributes
589
            ->expects($this->at(1))
590
            ->method('get')
591
            ->with($this->identicalTo('_route'), $this->isNull())
592
            ->will($this->returnValue('route'));
593
594
        $this->parameterResolver->resolveRedirectRoute();
595
    }
596
597
    public function testResolveRedirectRouteParametersWithoutRequest()
598
    {
@@ 954-974 (lines=21) @@
951
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
952
     * @expectedExceptionMessage The template could not be found for the route "route".
953
     */
954
    public function testResolveTemplateMissing()
955
    {
956
        $this->requestStack
957
            ->expects($this->exactly(2))
958
            ->method('getMasterRequest')
959
            ->will($this->returnValue($request = $this->createRequestMock()));
960
961
        $request->attributes
962
            ->expects($this->at(0))
963
            ->method('get')
964
            ->with($this->identicalTo('_lug_template'), $this->isNull())
965
            ->will($this->returnValue(null));
966
967
        $request->attributes
968
            ->expects($this->at(1))
969
            ->method('get')
970
            ->with($this->identicalTo('_route'), $this->isNull())
971
            ->will($this->returnValue('route'));
972
973
        $this->parameterResolver->resolveTemplate();
974
    }
975
976
    public function testResolveThemesWithoutRequest()
977
    {