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