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
@@ 439-459 (lines=21) @@
436
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
437
     * @expectedExceptionMessage The location route could not be found for the route "route".
438
     */
439
    public function testResolveLocationRouteMissing()
440
    {
441
        $this->requestStack
442
            ->expects($this->exactly(2))
443
            ->method('getMasterRequest')
444
            ->will($this->returnValue($request = $this->createRequestMock()));
445
446
        $request->attributes
447
            ->expects($this->at(0))
448
            ->method('get')
449
            ->with($this->identicalTo('_lug_location_route'), $this->isNull())
450
            ->will($this->returnValue(null));
451
452
        $request->attributes
453
            ->expects($this->at(1))
454
            ->method('get')
455
            ->with($this->identicalTo('_route'), $this->isNull())
456
            ->will($this->returnValue('route'));
457
458
        $this->parameterResolver->resolveLocationRoute();
459
    }
460
461
    public function testResolveLocationRouteParametersWithoutRequest()
462
    {
@@ 573-593 (lines=21) @@
570
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
571
     * @expectedExceptionMessage The redirect route could not be found for the route "route".
572
     */
573
    public function testResolveRedirectRouteMissing()
574
    {
575
        $this->requestStack
576
            ->expects($this->exactly(2))
577
            ->method('getMasterRequest')
578
            ->will($this->returnValue($request = $this->createRequestMock()));
579
580
        $request->attributes
581
            ->expects($this->at(0))
582
            ->method('get')
583
            ->with($this->identicalTo('_lug_redirect_route'), $this->isNull())
584
            ->will($this->returnValue(null));
585
586
        $request->attributes
587
            ->expects($this->at(1))
588
            ->method('get')
589
            ->with($this->identicalTo('_route'), $this->isNull())
590
            ->will($this->returnValue('route'));
591
592
        $this->parameterResolver->resolveRedirectRoute();
593
    }
594
595
    public function testResolveRedirectRouteParametersWithoutRequest()
596
    {
@@ 925-945 (lines=21) @@
922
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
923
     * @expectedExceptionMessage The template could not be found for the route "route".
924
     */
925
    public function testResolveTemplateMissing()
926
    {
927
        $this->requestStack
928
            ->expects($this->exactly(2))
929
            ->method('getMasterRequest')
930
            ->will($this->returnValue($request = $this->createRequestMock()));
931
932
        $request->attributes
933
            ->expects($this->at(0))
934
            ->method('get')
935
            ->with($this->identicalTo('_lug_template'), $this->isNull())
936
            ->will($this->returnValue(null));
937
938
        $request->attributes
939
            ->expects($this->at(1))
940
            ->method('get')
941
            ->with($this->identicalTo('_route'), $this->isNull())
942
            ->will($this->returnValue('route'));
943
944
        $this->parameterResolver->resolveTemplate();
945
    }
946
947
    public function testResolveThemesWithoutRequest()
948
    {