Code Duplication    Length = 15-15 lines in 8 locations

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

@@ 676-690 (lines=15) @@
673
        );
674
    }
675
676
    public function testResolveRedirectRouteParametersWithoutObject()
677
    {
678
        $this->requestStack
679
            ->expects($this->once())
680
            ->method('getMasterRequest')
681
            ->will($this->returnValue($request = $this->createRequestMock()));
682
683
        $request->attributes
684
            ->expects($this->once())
685
            ->method('get')
686
            ->with($this->identicalTo('_lug_redirect_route_parameters'), $this->identicalTo([]))
687
            ->will($this->returnValue([]));
688
689
        $this->assertEmpty($this->parameterResolver->resolveRedirectRouteParameters());
690
    }
691
692
    /**
693
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
@@ 696-710 (lines=15) @@
693
     * @expectedException \Lug\Bundle\ResourceBundle\Exception\RuntimeException
694
     * @expectedExceptionMessage The route parameters could not be found for the route "redirect_route_parameters".
695
     */
696
    public function testResolveRedirectRouteParametersWithObjectMissing()
697
    {
698
        $this->requestStack
699
            ->expects($this->once())
700
            ->method('getMasterRequest')
701
            ->will($this->returnValue($request = $this->createRequestMock()));
702
703
        $request->attributes
704
            ->expects($this->once())
705
            ->method('get')
706
            ->with($this->identicalTo('_lug_redirect_route_parameters'), $this->identicalTo([]))
707
            ->will($this->returnValue(['id']));
708
709
        $this->assertEmpty($this->parameterResolver->resolveRedirectRouteParameters());
710
    }
711
712
    public function testResolveRedirectRouteParametersForwardWithoutRequest()
713
    {
@@ 791-805 (lines=15) @@
788
        $this->assertEmpty($this->parameterResolver->resolveSerializerGroups());
789
    }
790
791
    public function testResolveSerializerGroupsDefault()
792
    {
793
        $this->requestStack
794
            ->expects($this->once())
795
            ->method('getMasterRequest')
796
            ->will($this->returnValue($request = $this->createRequestMock()));
797
798
        $request->attributes
799
            ->expects($this->once())
800
            ->method('get')
801
            ->with($this->identicalTo('_lug_serializer_groups'), $this->identicalTo($groups = []))
802
            ->will($this->returnValue($groups));
803
804
        $this->assertEmpty($this->parameterResolver->resolveSerializerGroups());
805
    }
806
807
    public function testResolveSerializerGroupsExplicit()
808
    {
@@ 807-821 (lines=15) @@
804
        $this->assertEmpty($this->parameterResolver->resolveSerializerGroups());
805
    }
806
807
    public function testResolveSerializerGroupsExplicit()
808
    {
809
        $this->requestStack
810
            ->expects($this->once())
811
            ->method('getMasterRequest')
812
            ->will($this->returnValue($request = $this->createRequestMock()));
813
814
        $request->attributes
815
            ->expects($this->once())
816
            ->method('get')
817
            ->with($this->identicalTo('_lug_serializer_groups'), $this->identicalTo([]))
818
            ->will($this->returnValue($groups = ['group']));
819
820
        $this->assertSame($groups, $this->parameterResolver->resolveSerializerGroups());
821
    }
822
823
    public function testResolveSerializerNullWithoutRequest()
824
    {
@@ 865-879 (lines=15) @@
862
        $this->assertEmpty($this->parameterResolver->resolveSorting());
863
    }
864
865
    public function testResolveSortingDefault()
866
    {
867
        $this->requestStack
868
            ->expects($this->once())
869
            ->method('getMasterRequest')
870
            ->will($this->returnValue($request = $this->createRequestMock()));
871
872
        $request->attributes
873
            ->expects($this->once())
874
            ->method('get')
875
            ->with($this->identicalTo('_lug_sorting'), $this->identicalTo($sorting = []))
876
            ->will($this->returnValue($sorting));
877
878
        $this->assertEmpty($this->parameterResolver->resolveSorting());
879
    }
880
881
    public function testResolveSortingExplicit()
882
    {
@@ 881-895 (lines=15) @@
878
        $this->assertEmpty($this->parameterResolver->resolveSorting());
879
    }
880
881
    public function testResolveSortingExplicit()
882
    {
883
        $this->requestStack
884
            ->expects($this->once())
885
            ->method('getMasterRequest')
886
            ->will($this->returnValue($request = $this->createRequestMock()));
887
888
        $request->attributes
889
            ->expects($this->once())
890
            ->method('get')
891
            ->with($this->identicalTo('_lug_sorting'), $this->identicalTo([]))
892
            ->will($this->returnValue($sorting = ['foo' => 'ASC']));
893
894
        $this->assertSame($sorting, $this->parameterResolver->resolveSorting());
895
    }
896
897
    public function testResolveTemplate()
898
    {
@@ 953-967 (lines=15) @@
950
        $this->assertEmpty($this->parameterResolver->resolveThemes());
951
    }
952
953
    public function testResolveThemesDefault()
954
    {
955
        $this->requestStack
956
            ->expects($this->once())
957
            ->method('getMasterRequest')
958
            ->will($this->returnValue($request = $this->createRequestMock()));
959
960
        $request->attributes
961
            ->expects($this->once())
962
            ->method('get')
963
            ->with($this->identicalTo('_lug_themes'), $this->identicalTo($themes = []))
964
            ->will($this->returnValue($themes));
965
966
        $this->assertEmpty($this->parameterResolver->resolveThemes());
967
    }
968
969
    public function testResolveThemesExplicit()
970
    {
@@ 969-983 (lines=15) @@
966
        $this->assertEmpty($this->parameterResolver->resolveThemes());
967
    }
968
969
    public function testResolveThemesExplicit()
970
    {
971
        $this->requestStack
972
            ->expects($this->once())
973
            ->method('getMasterRequest')
974
            ->will($this->returnValue($request = $this->createRequestMock()));
975
976
        $request->attributes
977
            ->expects($this->once())
978
            ->method('get')
979
            ->with($this->identicalTo('_lug_themes'), $this->identicalTo([]))
980
            ->will($this->returnValue($themes = ['theme']));
981
982
        $this->assertSame($themes, $this->parameterResolver->resolveThemes());
983
    }
984
985
    public function testResolveTranslationDomainWithoutRequest()
986
    {