Code Duplication    Length = 122-122 lines in 2 locations

eZ/Publish/Core/Persistence/Legacy/Tests/Content/UrlAlias/UrlAliasHandlerTest.php 2 locations

@@ 3693-3814 (lines=122) @@
3690
     *
3691
     * @group swap
3692
     */
3693
    public function testLocationSwappedSiblingsSimpleWithHistory()
3694
    {
3695
        $handler = $this->getHandler();
3696
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_siblings_simple_history.php');
3697
3698
        $countBeforeReusing = $this->countRows();
3699
3700
        $handler->locationSwapped(314, 2, 315, 2);
3701
3702
        $this->assertEquals(
3703
            $countBeforeReusing,
3704
            $this->countRows()
3705
        );
3706
3707
        $urlAlias = $handler->lookup('jedan');
3708
        $this->assertEquals(
3709
            new UrlAlias(
3710
                array(
3711
                    'id' => '0-' . md5('jedan'),
3712
                    'type' => UrlAlias::LOCATION,
3713
                    'destination' => 314,
3714
                    'languageCodes' => array(
3715
                        'cro-HR',
3716
                    ),
3717
                    'pathData' => array(
3718
                        array(
3719
                            'always-available' => false,
3720
                            'translations' => array(
3721
                                'cro-HR' => 'jedan',
3722
                            ),
3723
                        ),
3724
                    ),
3725
                    'alwaysAvailable' => false,
3726
                    'isHistory' => true,
3727
                    'isCustom' => false,
3728
                    'forward' => false,
3729
                )
3730
            ),
3731
            $urlAlias
3732
        );
3733
3734
        $urlAlias = $handler->lookup('dva');
3735
        $this->assertEquals(
3736
            new UrlAlias(
3737
                array(
3738
                    'id' => '0-' . md5('dva'),
3739
                    'type' => UrlAlias::LOCATION,
3740
                    'destination' => 315,
3741
                    'languageCodes' => array(
3742
                        'cro-HR',
3743
                    ),
3744
                    'pathData' => array(
3745
                        array(
3746
                            'always-available' => false,
3747
                            'translations' => array(
3748
                                'cro-HR' => 'dva',
3749
                            ),
3750
                        ),
3751
                    ),
3752
                    'alwaysAvailable' => false,
3753
                    'isHistory' => true,
3754
                    'isCustom' => false,
3755
                    'forward' => false,
3756
                )
3757
            ),
3758
            $urlAlias
3759
        );
3760
3761
        $urlAlias = $handler->lookup('jedan-new');
3762
        $this->assertEquals(
3763
            new UrlAlias(
3764
                array(
3765
                    'id' => '0-' . md5('jedan-new'),
3766
                    'type' => UrlAlias::LOCATION,
3767
                    'destination' => 315,
3768
                    'languageCodes' => array(
3769
                        'cro-HR',
3770
                    ),
3771
                    'pathData' => array(
3772
                        array(
3773
                            'always-available' => false,
3774
                            'translations' => array(
3775
                                'cro-HR' => 'jedan-new',
3776
                            ),
3777
                        ),
3778
                    ),
3779
                    'alwaysAvailable' => false,
3780
                    'isHistory' => false,
3781
                    'isCustom' => false,
3782
                    'forward' => false,
3783
                )
3784
            ),
3785
            $urlAlias
3786
        );
3787
3788
        $urlAlias = $handler->lookup('dva-new');
3789
        $this->assertEquals(
3790
            new UrlAlias(
3791
                array(
3792
                    'id' => '0-' . md5('dva-new'),
3793
                    'type' => UrlAlias::LOCATION,
3794
                    'destination' => 314,
3795
                    'languageCodes' => array(
3796
                        'cro-HR',
3797
                    ),
3798
                    'pathData' => array(
3799
                        array(
3800
                            'always-available' => false,
3801
                            'translations' => array(
3802
                                'cro-HR' => 'dva-new',
3803
                            ),
3804
                        ),
3805
                    ),
3806
                    'alwaysAvailable' => false,
3807
                    'isHistory' => false,
3808
                    'isCustom' => false,
3809
                    'forward' => false,
3810
                )
3811
            ),
3812
            $urlAlias
3813
        );
3814
    }
3815
3816
    /**
3817
     * Test for the locationSwapped() method.
@@ 3821-3942 (lines=122) @@
3818
     *
3819
     * @group swap
3820
     */
3821
    public function testLocationSwappedSiblingsSimpleWithHistoryReverse()
3822
    {
3823
        $handler = $this->getHandler();
3824
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_siblings_simple_history.php');
3825
3826
        $countBeforeReusing = $this->countRows();
3827
3828
        $handler->locationSwapped(315, 2, 314, 2);
3829
3830
        $this->assertEquals(
3831
            $countBeforeReusing,
3832
            $this->countRows()
3833
        );
3834
3835
        $urlAlias = $handler->lookup('jedan');
3836
        $this->assertEquals(
3837
            new UrlAlias(
3838
                array(
3839
                    'id' => '0-' . md5('jedan'),
3840
                    'type' => UrlAlias::LOCATION,
3841
                    'destination' => 314,
3842
                    'languageCodes' => array(
3843
                        'cro-HR',
3844
                    ),
3845
                    'pathData' => array(
3846
                        array(
3847
                            'always-available' => false,
3848
                            'translations' => array(
3849
                                'cro-HR' => 'jedan',
3850
                            ),
3851
                        ),
3852
                    ),
3853
                    'alwaysAvailable' => false,
3854
                    'isHistory' => true,
3855
                    'isCustom' => false,
3856
                    'forward' => false,
3857
                )
3858
            ),
3859
            $urlAlias
3860
        );
3861
3862
        $urlAlias = $handler->lookup('dva');
3863
        $this->assertEquals(
3864
            new UrlAlias(
3865
                array(
3866
                    'id' => '0-' . md5('dva'),
3867
                    'type' => UrlAlias::LOCATION,
3868
                    'destination' => 315,
3869
                    'languageCodes' => array(
3870
                        'cro-HR',
3871
                    ),
3872
                    'pathData' => array(
3873
                        array(
3874
                            'always-available' => false,
3875
                            'translations' => array(
3876
                                'cro-HR' => 'dva',
3877
                            ),
3878
                        ),
3879
                    ),
3880
                    'alwaysAvailable' => false,
3881
                    'isHistory' => true,
3882
                    'isCustom' => false,
3883
                    'forward' => false,
3884
                )
3885
            ),
3886
            $urlAlias
3887
        );
3888
3889
        $urlAlias = $handler->lookup('jedan-new');
3890
        $this->assertEquals(
3891
            new UrlAlias(
3892
                array(
3893
                    'id' => '0-' . md5('jedan-new'),
3894
                    'type' => UrlAlias::LOCATION,
3895
                    'destination' => 315,
3896
                    'languageCodes' => array(
3897
                        'cro-HR',
3898
                    ),
3899
                    'pathData' => array(
3900
                        array(
3901
                            'always-available' => false,
3902
                            'translations' => array(
3903
                                'cro-HR' => 'jedan-new',
3904
                            ),
3905
                        ),
3906
                    ),
3907
                    'alwaysAvailable' => false,
3908
                    'isHistory' => false,
3909
                    'isCustom' => false,
3910
                    'forward' => false,
3911
                )
3912
            ),
3913
            $urlAlias
3914
        );
3915
3916
        $urlAlias = $handler->lookup('dva-new');
3917
        $this->assertEquals(
3918
            new UrlAlias(
3919
                array(
3920
                    'id' => '0-' . md5('dva-new'),
3921
                    'type' => UrlAlias::LOCATION,
3922
                    'destination' => 314,
3923
                    'languageCodes' => array(
3924
                        'cro-HR',
3925
                    ),
3926
                    'pathData' => array(
3927
                        array(
3928
                            'always-available' => false,
3929
                            'translations' => array(
3930
                                'cro-HR' => 'dva-new',
3931
                            ),
3932
                        ),
3933
                    ),
3934
                    'alwaysAvailable' => false,
3935
                    'isHistory' => false,
3936
                    'isCustom' => false,
3937
                    'forward' => false,
3938
                )
3939
            ),
3940
            $urlAlias
3941
        );
3942
    }
3943
3944
    /**
3945
     * Test for the locationSwapped() method.