Code Duplication    Length = 39-39 lines in 2 locations

eZ/Publish/Core/Persistence/Legacy/Tests/Content/UrlAlias/UrlAliasHandlerTest.php 2 locations

@@ 2675-2713 (lines=39) @@
2672
     *
2673
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved
2674
     */
2675
    public function testLocationMovedHistorySubtree()
2676
    {
2677
        $handler = $this->getHandler();
2678
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_move.php');
2679
2680
        $handler->publishUrlAliasForLocation(4, 3, 'move-this', 'eng-GB', false);
2681
        $handler->locationMoved(4, 2, 3);
2682
2683
        $urlAlias = $handler->lookup('move-this/sub1/sub2');
2684
        self::assertEquals(
2685
            new UrlAlias(
2686
                array(
2687
                    'id' => '5-' . md5('sub2'),
2688
                    'type' => UrlAlias::LOCATION,
2689
                    'destination' => '6',
2690
                    'languageCodes' => array('eng-GB'),
2691
                    'pathData' => array(
2692
                        array(
2693
                            'always-available' => false,
2694
                            'translations' => array('eng-GB' => 'move-this'),
2695
                        ),
2696
                        array(
2697
                            'always-available' => false,
2698
                            'translations' => array('eng-GB' => 'sub1'),
2699
                        ),
2700
                        array(
2701
                            'always-available' => false,
2702
                            'translations' => array('eng-GB' => 'sub2'),
2703
                        ),
2704
                    ),
2705
                    'alwaysAvailable' => false,
2706
                    'isHistory' => true,
2707
                    'isCustom' => false,
2708
                    'forward' => false,
2709
                )
2710
            ),
2711
            $urlAlias
2712
        );
2713
    }
2714
2715
    /**
2716
     * Test for the locationMoved() method.
@@ 2720-2758 (lines=39) @@
2717
     *
2718
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved
2719
     */
2720
    public function testLocationMovedReparent()
2721
    {
2722
        $handler = $this->getHandler();
2723
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_move.php');
2724
2725
        $handler->publishUrlAliasForLocation(4, 3, 'move-this', 'eng-GB', false);
2726
        $handler->locationMoved(4, 2, 3);
2727
2728
        $urlAlias = $handler->lookup('move-here/move-this/sub1');
2729
        self::assertEquals(
2730
            new UrlAlias(
2731
                array(
2732
                    'id' => '9-' . md5('sub1'),
2733
                    'type' => UrlAlias::LOCATION,
2734
                    'destination' => '5',
2735
                    'languageCodes' => array('eng-GB'),
2736
                    'pathData' => array(
2737
                        array(
2738
                            'always-available' => false,
2739
                            'translations' => array('eng-GB' => 'move-here'),
2740
                        ),
2741
                        array(
2742
                            'always-available' => false,
2743
                            'translations' => array('eng-GB' => 'move-this'),
2744
                        ),
2745
                        array(
2746
                            'always-available' => false,
2747
                            'translations' => array('eng-GB' => 'sub1'),
2748
                        ),
2749
                    ),
2750
                    'alwaysAvailable' => false,
2751
                    'isHistory' => false,
2752
                    'isCustom' => false,
2753
                    'forward' => false,
2754
                )
2755
            ),
2756
            $urlAlias
2757
        );
2758
    }
2759
2760
    /**
2761
     * Test for the locationMoved() method.