Code Duplication    Length = 15-15 lines in 6 locations

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

@@ 677-691 (lines=15) @@
674
        );
675
    }
676
677
    public function testResolveRedirectRouteParametersWithoutObject()
678
    {
679
        $this->requestStack
680
            ->expects($this->once())
681
            ->method('getMasterRequest')
682
            ->will($this->returnValue($request = $this->createRequestMock()));
683
684
        $request->attributes
685
            ->expects($this->once())
686
            ->method('get')
687
            ->with($this->identicalTo('_lug_redirect_route_parameters'), $this->identicalTo([]))
688
            ->will($this->returnValue([]));
689
690
        $this->assertEmpty($this->parameterResolver->resolveRedirectRouteParameters());
691
    }
692
693
    /**
694
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
@@ 697-711 (lines=15) @@
694
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
695
     * @expectedExceptionMessage The route parameters could not be found for the route "redirect_route_parameters".
696
     */
697
    public function testResolveRedirectRouteParametersWithObjectMissing()
698
    {
699
        $this->requestStack
700
            ->expects($this->once())
701
            ->method('getMasterRequest')
702
            ->will($this->returnValue($request = $this->createRequestMock()));
703
704
        $request->attributes
705
            ->expects($this->once())
706
            ->method('get')
707
            ->with($this->identicalTo('_lug_redirect_route_parameters'), $this->identicalTo([]))
708
            ->will($this->returnValue(['id']));
709
710
        $this->assertEmpty($this->parameterResolver->resolveRedirectRouteParameters());
711
    }
712
713
    public function testResolveRedirectRouteParametersForwardWithoutRequest()
714
    {
@@ 893-907 (lines=15) @@
890
        $this->assertEmpty($this->parameterResolver->resolveSorting());
891
    }
892
893
    public function testResolveSortingDefault()
894
    {
895
        $this->requestStack
896
            ->expects($this->once())
897
            ->method('getMasterRequest')
898
            ->will($this->returnValue($request = $this->createRequestMock()));
899
900
        $request->attributes
901
            ->expects($this->once())
902
            ->method('get')
903
            ->with($this->identicalTo('_lug_sorting'), $this->identicalTo($sorting = []))
904
            ->will($this->returnValue($sorting));
905
906
        $this->assertEmpty($this->parameterResolver->resolveSorting());
907
    }
908
909
    public function testResolveSortingExplicit()
910
    {
@@ 909-923 (lines=15) @@
906
        $this->assertEmpty($this->parameterResolver->resolveSorting());
907
    }
908
909
    public function testResolveSortingExplicit()
910
    {
911
        $this->requestStack
912
            ->expects($this->once())
913
            ->method('getMasterRequest')
914
            ->will($this->returnValue($request = $this->createRequestMock()));
915
916
        $request->attributes
917
            ->expects($this->once())
918
            ->method('get')
919
            ->with($this->identicalTo('_lug_sorting'), $this->identicalTo([]))
920
            ->will($this->returnValue($sorting = ['foo' => 'ASC']));
921
922
        $this->assertSame($sorting, $this->parameterResolver->resolveSorting());
923
    }
924
925
    public function testResolveTemplate()
926
    {
@@ 981-995 (lines=15) @@
978
        $this->assertEmpty($this->parameterResolver->resolveThemes());
979
    }
980
981
    public function testResolveThemesDefault()
982
    {
983
        $this->requestStack
984
            ->expects($this->once())
985
            ->method('getMasterRequest')
986
            ->will($this->returnValue($request = $this->createRequestMock()));
987
988
        $request->attributes
989
            ->expects($this->once())
990
            ->method('get')
991
            ->with($this->identicalTo('_lug_themes'), $this->identicalTo($themes = []))
992
            ->will($this->returnValue($themes));
993
994
        $this->assertEmpty($this->parameterResolver->resolveThemes());
995
    }
996
997
    public function testResolveThemesExplicit()
998
    {
@@ 997-1011 (lines=15) @@
994
        $this->assertEmpty($this->parameterResolver->resolveThemes());
995
    }
996
997
    public function testResolveThemesExplicit()
998
    {
999
        $this->requestStack
1000
            ->expects($this->once())
1001
            ->method('getMasterRequest')
1002
            ->will($this->returnValue($request = $this->createRequestMock()));
1003
1004
        $request->attributes
1005
            ->expects($this->once())
1006
            ->method('get')
1007
            ->with($this->identicalTo('_lug_themes'), $this->identicalTo([]))
1008
            ->will($this->returnValue($themes = ['theme']));
1009
1010
        $this->assertSame($themes, $this->parameterResolver->resolveThemes());
1011
    }
1012
1013
    public function testResolveTranslationDomainWithoutRequest()
1014
    {