Code Duplication    Length = 122-122 lines in 2 locations

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

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