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