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