Code Duplication    Length = 122-122 lines in 2 locations

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

@@ 3623-3744 (lines=122) @@
3620
     *
3621
     * @group swap
3622
     */
3623
    public function testLocationSwappedSiblingsSimpleWithHistory()
3624
    {
3625
        $handler = $this->getHandler();
3626
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_siblings_simple_history.php');
3627
3628
        $countBeforeReusing = $this->countRows();
3629
3630
        $handler->locationSwapped(314, 2, 315, 2);
3631
3632
        $this->assertEquals(
3633
            $countBeforeReusing,
3634
            $this->countRows()
3635
        );
3636
3637
        $urlAlias = $handler->lookup('jedan');
3638
        $this->assertEquals(
3639
            new UrlAlias(
3640
                array(
3641
                    'id' => '0-' . md5('jedan'),
3642
                    'type' => UrlAlias::LOCATION,
3643
                    'destination' => 314,
3644
                    'languageCodes' => array(
3645
                        'cro-HR',
3646
                    ),
3647
                    'pathData' => array(
3648
                        array(
3649
                            'always-available' => false,
3650
                            'translations' => array(
3651
                                'cro-HR' => 'jedan',
3652
                            ),
3653
                        ),
3654
                    ),
3655
                    'alwaysAvailable' => false,
3656
                    'isHistory' => true,
3657
                    'isCustom' => false,
3658
                    'forward' => false,
3659
                )
3660
            ),
3661
            $urlAlias
3662
        );
3663
3664
        $urlAlias = $handler->lookup('dva');
3665
        $this->assertEquals(
3666
            new UrlAlias(
3667
                array(
3668
                    'id' => '0-' . md5('dva'),
3669
                    'type' => UrlAlias::LOCATION,
3670
                    'destination' => 315,
3671
                    'languageCodes' => array(
3672
                        'cro-HR',
3673
                    ),
3674
                    'pathData' => array(
3675
                        array(
3676
                            'always-available' => false,
3677
                            'translations' => array(
3678
                                'cro-HR' => 'dva',
3679
                            ),
3680
                        ),
3681
                    ),
3682
                    'alwaysAvailable' => false,
3683
                    'isHistory' => true,
3684
                    'isCustom' => false,
3685
                    'forward' => false,
3686
                )
3687
            ),
3688
            $urlAlias
3689
        );
3690
3691
        $urlAlias = $handler->lookup('jedan-new');
3692
        $this->assertEquals(
3693
            new UrlAlias(
3694
                array(
3695
                    'id' => '0-' . md5('jedan-new'),
3696
                    'type' => UrlAlias::LOCATION,
3697
                    'destination' => 315,
3698
                    'languageCodes' => array(
3699
                        'cro-HR',
3700
                    ),
3701
                    'pathData' => array(
3702
                        array(
3703
                            'always-available' => false,
3704
                            'translations' => array(
3705
                                'cro-HR' => 'jedan-new',
3706
                            ),
3707
                        ),
3708
                    ),
3709
                    'alwaysAvailable' => false,
3710
                    'isHistory' => false,
3711
                    'isCustom' => false,
3712
                    'forward' => false,
3713
                )
3714
            ),
3715
            $urlAlias
3716
        );
3717
3718
        $urlAlias = $handler->lookup('dva-new');
3719
        $this->assertEquals(
3720
            new UrlAlias(
3721
                array(
3722
                    'id' => '0-' . md5('dva-new'),
3723
                    'type' => UrlAlias::LOCATION,
3724
                    'destination' => 314,
3725
                    'languageCodes' => array(
3726
                        'cro-HR',
3727
                    ),
3728
                    'pathData' => array(
3729
                        array(
3730
                            'always-available' => false,
3731
                            'translations' => array(
3732
                                'cro-HR' => 'dva-new',
3733
                            ),
3734
                        ),
3735
                    ),
3736
                    'alwaysAvailable' => false,
3737
                    'isHistory' => false,
3738
                    'isCustom' => false,
3739
                    'forward' => false,
3740
                )
3741
            ),
3742
            $urlAlias
3743
        );
3744
    }
3745
3746
    /**
3747
     * Test for the locationSwapped() method.
@@ 3751-3872 (lines=122) @@
3748
     *
3749
     * @group swap
3750
     */
3751
    public function testLocationSwappedSiblingsSimpleWithHistoryReverse()
3752
    {
3753
        $handler = $this->getHandler();
3754
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_siblings_simple_history.php');
3755
3756
        $countBeforeReusing = $this->countRows();
3757
3758
        $handler->locationSwapped(315, 2, 314, 2);
3759
3760
        $this->assertEquals(
3761
            $countBeforeReusing,
3762
            $this->countRows()
3763
        );
3764
3765
        $urlAlias = $handler->lookup('jedan');
3766
        $this->assertEquals(
3767
            new UrlAlias(
3768
                array(
3769
                    'id' => '0-' . md5('jedan'),
3770
                    'type' => UrlAlias::LOCATION,
3771
                    'destination' => 314,
3772
                    'languageCodes' => array(
3773
                        'cro-HR',
3774
                    ),
3775
                    'pathData' => array(
3776
                        array(
3777
                            'always-available' => false,
3778
                            'translations' => array(
3779
                                'cro-HR' => 'jedan',
3780
                            ),
3781
                        ),
3782
                    ),
3783
                    'alwaysAvailable' => false,
3784
                    'isHistory' => true,
3785
                    'isCustom' => false,
3786
                    'forward' => false,
3787
                )
3788
            ),
3789
            $urlAlias
3790
        );
3791
3792
        $urlAlias = $handler->lookup('dva');
3793
        $this->assertEquals(
3794
            new UrlAlias(
3795
                array(
3796
                    'id' => '0-' . md5('dva'),
3797
                    'type' => UrlAlias::LOCATION,
3798
                    'destination' => 315,
3799
                    'languageCodes' => array(
3800
                        'cro-HR',
3801
                    ),
3802
                    'pathData' => array(
3803
                        array(
3804
                            'always-available' => false,
3805
                            'translations' => array(
3806
                                'cro-HR' => 'dva',
3807
                            ),
3808
                        ),
3809
                    ),
3810
                    'alwaysAvailable' => false,
3811
                    'isHistory' => true,
3812
                    'isCustom' => false,
3813
                    'forward' => false,
3814
                )
3815
            ),
3816
            $urlAlias
3817
        );
3818
3819
        $urlAlias = $handler->lookup('jedan-new');
3820
        $this->assertEquals(
3821
            new UrlAlias(
3822
                array(
3823
                    'id' => '0-' . md5('jedan-new'),
3824
                    'type' => UrlAlias::LOCATION,
3825
                    'destination' => 315,
3826
                    'languageCodes' => array(
3827
                        'cro-HR',
3828
                    ),
3829
                    'pathData' => array(
3830
                        array(
3831
                            'always-available' => false,
3832
                            'translations' => array(
3833
                                'cro-HR' => 'jedan-new',
3834
                            ),
3835
                        ),
3836
                    ),
3837
                    'alwaysAvailable' => false,
3838
                    'isHistory' => false,
3839
                    'isCustom' => false,
3840
                    'forward' => false,
3841
                )
3842
            ),
3843
            $urlAlias
3844
        );
3845
3846
        $urlAlias = $handler->lookup('dva-new');
3847
        $this->assertEquals(
3848
            new UrlAlias(
3849
                array(
3850
                    'id' => '0-' . md5('dva-new'),
3851
                    'type' => UrlAlias::LOCATION,
3852
                    'destination' => 314,
3853
                    'languageCodes' => array(
3854
                        'cro-HR',
3855
                    ),
3856
                    'pathData' => array(
3857
                        array(
3858
                            'always-available' => false,
3859
                            'translations' => array(
3860
                                'cro-HR' => 'dva-new',
3861
                            ),
3862
                        ),
3863
                    ),
3864
                    'alwaysAvailable' => false,
3865
                    'isHistory' => false,
3866
                    'isCustom' => false,
3867
                    'forward' => false,
3868
                )
3869
            ),
3870
            $urlAlias
3871
        );
3872
    }
3873
3874
    /**
3875
     * Test for the locationSwapped() method.