Code Duplication    Length = 122-122 lines in 2 locations

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

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