Code Duplication    Length = 21-21 lines in 4 locations

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

@@ 166-186 (lines=21) @@
163
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
164
     * @expectedExceptionMessage The criteria could not be found for the route "route".
165
     */
166
    public function testResolveCriteriaMandatoryWithoutCriteria()
167
    {
168
        $this->requestStack
169
            ->expects($this->exactly(2))
170
            ->method('getMasterRequest')
171
            ->will($this->returnValue($request = $this->createRequestMock()));
172
173
        $request->attributes
174
            ->expects($this->at(0))
175
            ->method('get')
176
            ->with($this->identicalTo('_lug_criteria'), $this->identicalTo(['id']))
177
            ->will($this->returnValue([]));
178
179
        $request->attributes
180
            ->expects($this->at(1))
181
            ->method('get')
182
            ->with($this->identicalTo('_route'), $this->isNull())
183
            ->will($this->returnValue('route'));
184
185
        $this->parameterResolver->resolveCriteria(true);
186
    }
187
188
    /**
189
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
@@ 440-460 (lines=21) @@
437
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
438
     * @expectedExceptionMessage The location route could not be found for the route "route".
439
     */
440
    public function testResolveLocationRouteMissing()
441
    {
442
        $this->requestStack
443
            ->expects($this->exactly(2))
444
            ->method('getMasterRequest')
445
            ->will($this->returnValue($request = $this->createRequestMock()));
446
447
        $request->attributes
448
            ->expects($this->at(0))
449
            ->method('get')
450
            ->with($this->identicalTo('_lug_location_route'), $this->isNull())
451
            ->will($this->returnValue(null));
452
453
        $request->attributes
454
            ->expects($this->at(1))
455
            ->method('get')
456
            ->with($this->identicalTo('_route'), $this->isNull())
457
            ->will($this->returnValue('route'));
458
459
        $this->parameterResolver->resolveLocationRoute();
460
    }
461
462
    public function testResolveLocationRouteParametersWithoutRequest()
463
    {
@@ 574-594 (lines=21) @@
571
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
572
     * @expectedExceptionMessage The redirect route could not be found for the route "route".
573
     */
574
    public function testResolveRedirectRouteMissing()
575
    {
576
        $this->requestStack
577
            ->expects($this->exactly(2))
578
            ->method('getMasterRequest')
579
            ->will($this->returnValue($request = $this->createRequestMock()));
580
581
        $request->attributes
582
            ->expects($this->at(0))
583
            ->method('get')
584
            ->with($this->identicalTo('_lug_redirect_route'), $this->isNull())
585
            ->will($this->returnValue(null));
586
587
        $request->attributes
588
            ->expects($this->at(1))
589
            ->method('get')
590
            ->with($this->identicalTo('_route'), $this->isNull())
591
            ->will($this->returnValue('route'));
592
593
        $this->parameterResolver->resolveRedirectRoute();
594
    }
595
596
    public function testResolveRedirectRouteParametersWithoutRequest()
597
    {
@@ 926-946 (lines=21) @@
923
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
924
     * @expectedExceptionMessage The template could not be found for the route "route".
925
     */
926
    public function testResolveTemplateMissing()
927
    {
928
        $this->requestStack
929
            ->expects($this->exactly(2))
930
            ->method('getMasterRequest')
931
            ->will($this->returnValue($request = $this->createRequestMock()));
932
933
        $request->attributes
934
            ->expects($this->at(0))
935
            ->method('get')
936
            ->with($this->identicalTo('_lug_template'), $this->isNull())
937
            ->will($this->returnValue(null));
938
939
        $request->attributes
940
            ->expects($this->at(1))
941
            ->method('get')
942
            ->with($this->identicalTo('_route'), $this->isNull())
943
            ->will($this->returnValue('route'));
944
945
        $this->parameterResolver->resolveTemplate();
946
    }
947
948
    public function testResolveThemesWithoutRequest()
949
    {