Code Duplication    Length = 21-21 lines in 4 locations

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

@@ 165-185 (lines=21) @@
162
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
163
     * @expectedExceptionMessage The criteria could not be found for the route "route".
164
     */
165
    public function testResolveCriteriaMandatoryWithoutCriteria()
166
    {
167
        $this->requestStack
168
            ->expects($this->exactly(2))
169
            ->method('getMasterRequest')
170
            ->will($this->returnValue($request = $this->createRequestMock()));
171
172
        $request->attributes
173
            ->expects($this->at(0))
174
            ->method('get')
175
            ->with($this->identicalTo('_lug_criteria'), $this->identicalTo(['id']))
176
            ->will($this->returnValue([]));
177
178
        $request->attributes
179
            ->expects($this->at(1))
180
            ->method('get')
181
            ->with($this->identicalTo('_route'), $this->isNull())
182
            ->will($this->returnValue('route'));
183
184
        $this->parameterResolver->resolveCriteria(true);
185
    }
186
187
    /**
188
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
@@ 405-425 (lines=21) @@
402
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
403
     * @expectedExceptionMessage The location route could not be found for the route "route".
404
     */
405
    public function testResolveLocationRouteMissing()
406
    {
407
        $this->requestStack
408
            ->expects($this->exactly(2))
409
            ->method('getMasterRequest')
410
            ->will($this->returnValue($request = $this->createRequestMock()));
411
412
        $request->attributes
413
            ->expects($this->at(0))
414
            ->method('get')
415
            ->with($this->identicalTo('_lug_location_route'), $this->isNull())
416
            ->will($this->returnValue(null));
417
418
        $request->attributes
419
            ->expects($this->at(1))
420
            ->method('get')
421
            ->with($this->identicalTo('_route'), $this->isNull())
422
            ->will($this->returnValue('route'));
423
424
        $this->parameterResolver->resolveLocationRoute();
425
    }
426
427
    public function testResolveLocationRouteParametersWithoutRequest()
428
    {
@@ 595-615 (lines=21) @@
592
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
593
     * @expectedExceptionMessage The redirect route could not be found for the route "route".
594
     */
595
    public function testResolveRedirectRouteMissing()
596
    {
597
        $this->requestStack
598
            ->expects($this->exactly(2))
599
            ->method('getMasterRequest')
600
            ->will($this->returnValue($request = $this->createRequestMock()));
601
602
        $request->attributes
603
            ->expects($this->at(0))
604
            ->method('get')
605
            ->with($this->identicalTo('_lug_redirect_route'), $this->isNull())
606
            ->will($this->returnValue(null));
607
608
        $request->attributes
609
            ->expects($this->at(1))
610
            ->method('get')
611
            ->with($this->identicalTo('_route'), $this->isNull())
612
            ->will($this->returnValue('route'));
613
614
        $this->parameterResolver->resolveRedirectRoute();
615
    }
616
617
    public function testResolveRedirectRouteParametersWithoutRequest()
618
    {
@@ 990-1010 (lines=21) @@
987
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
988
     * @expectedExceptionMessage The template could not be found for the route "route".
989
     */
990
    public function testResolveTemplateMissing()
991
    {
992
        $this->requestStack
993
            ->expects($this->exactly(2))
994
            ->method('getMasterRequest')
995
            ->will($this->returnValue($request = $this->createRequestMock()));
996
997
        $request->attributes
998
            ->expects($this->at(0))
999
            ->method('get')
1000
            ->with($this->identicalTo('_lug_template'), $this->isNull())
1001
            ->will($this->returnValue(null));
1002
1003
        $request->attributes
1004
            ->expects($this->at(1))
1005
            ->method('get')
1006
            ->with($this->identicalTo('_route'), $this->isNull())
1007
            ->will($this->returnValue('route'));
1008
1009
        $this->parameterResolver->resolveTemplate();
1010
    }
1011
1012
    public function testResolveThemesWithoutRequest()
1013
    {