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