| @@ 2780-2822 (lines=43) @@ | ||
| 2777 | * |
|
| 2778 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved |
|
| 2779 | */ |
|
| 2780 | public function testLocationMovedReparentSubtree() |
|
| 2781 | { |
|
| 2782 | $handler = $this->getHandler(); |
|
| 2783 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_move.php'); |
|
| 2784 | ||
| 2785 | $handler->publishUrlAliasForLocation(4, 3, 'move-this', 'eng-GB', false); |
|
| 2786 | $handler->locationMoved(4, 2, 3); |
|
| 2787 | ||
| 2788 | $urlAlias = $handler->lookup('move-here/move-this/sub1/sub2'); |
|
| 2789 | self::assertEquals( |
|
| 2790 | new UrlAlias( |
|
| 2791 | [ |
|
| 2792 | 'id' => '5-' . md5('sub2'), |
|
| 2793 | 'type' => UrlAlias::LOCATION, |
|
| 2794 | 'destination' => '6', |
|
| 2795 | 'languageCodes' => ['eng-GB'], |
|
| 2796 | 'pathData' => [ |
|
| 2797 | [ |
|
| 2798 | 'always-available' => false, |
|
| 2799 | 'translations' => ['eng-GB' => 'move-here'], |
|
| 2800 | ], |
|
| 2801 | [ |
|
| 2802 | 'always-available' => false, |
|
| 2803 | 'translations' => ['eng-GB' => 'move-this'], |
|
| 2804 | ], |
|
| 2805 | [ |
|
| 2806 | 'always-available' => false, |
|
| 2807 | 'translations' => ['eng-GB' => 'sub1'], |
|
| 2808 | ], |
|
| 2809 | [ |
|
| 2810 | 'always-available' => false, |
|
| 2811 | 'translations' => ['eng-GB' => 'sub2'], |
|
| 2812 | ], |
|
| 2813 | ], |
|
| 2814 | 'alwaysAvailable' => false, |
|
| 2815 | 'isHistory' => false, |
|
| 2816 | 'isCustom' => false, |
|
| 2817 | 'forward' => false, |
|
| 2818 | ] |
|
| 2819 | ), |
|
| 2820 | $urlAlias |
|
| 2821 | ); |
|
| 2822 | } |
|
| 2823 | ||
| 2824 | /** |
|
| 2825 | * Test for the locationMoved() method. |
|
| @@ 2829-2871 (lines=43) @@ | ||
| 2826 | * |
|
| 2827 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved |
|
| 2828 | */ |
|
| 2829 | public function testLocationMovedReparentSubtreeHistory() |
|
| 2830 | { |
|
| 2831 | $handler = $this->getHandler(); |
|
| 2832 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_move.php'); |
|
| 2833 | ||
| 2834 | $handler->publishUrlAliasForLocation(4, 3, 'move-this', 'eng-GB', false); |
|
| 2835 | $handler->locationMoved(4, 2, 3); |
|
| 2836 | ||
| 2837 | $urlAlias = $handler->lookup('move-here/move-this/sub1/sub2-history'); |
|
| 2838 | self::assertEquals( |
|
| 2839 | new UrlAlias( |
|
| 2840 | [ |
|
| 2841 | 'id' => '5-' . md5('sub2-history'), |
|
| 2842 | 'type' => UrlAlias::LOCATION, |
|
| 2843 | 'destination' => '6', |
|
| 2844 | 'languageCodes' => ['eng-GB'], |
|
| 2845 | 'pathData' => [ |
|
| 2846 | [ |
|
| 2847 | 'always-available' => false, |
|
| 2848 | 'translations' => ['eng-GB' => 'move-here'], |
|
| 2849 | ], |
|
| 2850 | [ |
|
| 2851 | 'always-available' => false, |
|
| 2852 | 'translations' => ['eng-GB' => 'move-this'], |
|
| 2853 | ], |
|
| 2854 | [ |
|
| 2855 | 'always-available' => false, |
|
| 2856 | 'translations' => ['eng-GB' => 'sub1'], |
|
| 2857 | ], |
|
| 2858 | [ |
|
| 2859 | 'always-available' => false, |
|
| 2860 | 'translations' => ['eng-GB' => 'sub2-history'], |
|
| 2861 | ], |
|
| 2862 | ], |
|
| 2863 | 'alwaysAvailable' => false, |
|
| 2864 | 'isHistory' => true, |
|
| 2865 | 'isCustom' => false, |
|
| 2866 | 'forward' => false, |
|
| 2867 | ] |
|
| 2868 | ), |
|
| 2869 | $urlAlias |
|
| 2870 | ); |
|
| 2871 | } |
|
| 2872 | ||
| 2873 | /** |
|
| 2874 | * Test for the locationCopied() method. |
|