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
    {
@@ 617-637 (lines=21) @@
614
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
615
     * @expectedExceptionMessage The redirect route could not be found for the route "route".
616
     */
617
    public function testResolveRedirectRouteMissing()
618
    {
619
        $this->requestStack
620
            ->expects($this->exactly(2))
621
            ->method('getMasterRequest')
622
            ->will($this->returnValue($request = $this->createRequestMock()));
623
624
        $request->attributes
625
            ->expects($this->at(0))
626
            ->method('get')
627
            ->with($this->identicalTo('_lug_redirect_route'), $this->isNull())
628
            ->will($this->returnValue(null));
629
630
        $request->attributes
631
            ->expects($this->at(1))
632
            ->method('get')
633
            ->with($this->identicalTo('_route'), $this->isNull())
634
            ->will($this->returnValue('route'));
635
636
        $this->parameterResolver->resolveRedirectRoute();
637
    }
638
639
    public function testResolveRedirectRouteParametersWithoutRequest()
640
    {
@@ 1012-1032 (lines=21) @@
1009
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
1010
     * @expectedExceptionMessage The template could not be found for the route "route".
1011
     */
1012
    public function testResolveTemplateMissing()
1013
    {
1014
        $this->requestStack
1015
            ->expects($this->exactly(2))
1016
            ->method('getMasterRequest')
1017
            ->will($this->returnValue($request = $this->createRequestMock()));
1018
1019
        $request->attributes
1020
            ->expects($this->at(0))
1021
            ->method('get')
1022
            ->with($this->identicalTo('_lug_template'), $this->isNull())
1023
            ->will($this->returnValue(null));
1024
1025
        $request->attributes
1026
            ->expects($this->at(1))
1027
            ->method('get')
1028
            ->with($this->identicalTo('_route'), $this->isNull())
1029
            ->will($this->returnValue('route'));
1030
1031
        $this->parameterResolver->resolveTemplate();
1032
    }
1033
1034
    public function testResolveThemesWithoutRequest()
1035
    {