Code Duplication    Length = 39-39 lines in 2 locations

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

@@ 2605-2643 (lines=39) @@
2602
     *
2603
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved
2604
     */
2605
    public function testLocationMovedHistorySubtree()
2606
    {
2607
        $handler = $this->getHandler();
2608
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_move.php');
2609
2610
        $handler->publishUrlAliasForLocation(4, 3, 'move-this', 'eng-GB', false);
2611
        $handler->locationMoved(4, 2, 3);
2612
2613
        $urlAlias = $handler->lookup('move-this/sub1/sub2');
2614
        self::assertEquals(
2615
            new UrlAlias(
2616
                array(
2617
                    'id' => '5-' . md5('sub2'),
2618
                    'type' => UrlAlias::LOCATION,
2619
                    'destination' => '6',
2620
                    'languageCodes' => array('eng-GB'),
2621
                    'pathData' => array(
2622
                        array(
2623
                            'always-available' => false,
2624
                            'translations' => array('eng-GB' => 'move-this'),
2625
                        ),
2626
                        array(
2627
                            'always-available' => false,
2628
                            'translations' => array('eng-GB' => 'sub1'),
2629
                        ),
2630
                        array(
2631
                            'always-available' => false,
2632
                            'translations' => array('eng-GB' => 'sub2'),
2633
                        ),
2634
                    ),
2635
                    'alwaysAvailable' => false,
2636
                    'isHistory' => true,
2637
                    'isCustom' => false,
2638
                    'forward' => false,
2639
                )
2640
            ),
2641
            $urlAlias
2642
        );
2643
    }
2644
2645
    /**
2646
     * Test for the locationMoved() method.
@@ 2650-2688 (lines=39) @@
2647
     *
2648
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved
2649
     */
2650
    public function testLocationMovedReparent()
2651
    {
2652
        $handler = $this->getHandler();
2653
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_move.php');
2654
2655
        $handler->publishUrlAliasForLocation(4, 3, 'move-this', 'eng-GB', false);
2656
        $handler->locationMoved(4, 2, 3);
2657
2658
        $urlAlias = $handler->lookup('move-here/move-this/sub1');
2659
        self::assertEquals(
2660
            new UrlAlias(
2661
                array(
2662
                    'id' => '9-' . md5('sub1'),
2663
                    'type' => UrlAlias::LOCATION,
2664
                    'destination' => '5',
2665
                    'languageCodes' => array('eng-GB'),
2666
                    'pathData' => array(
2667
                        array(
2668
                            'always-available' => false,
2669
                            'translations' => array('eng-GB' => 'move-here'),
2670
                        ),
2671
                        array(
2672
                            'always-available' => false,
2673
                            'translations' => array('eng-GB' => 'move-this'),
2674
                        ),
2675
                        array(
2676
                            'always-available' => false,
2677
                            'translations' => array('eng-GB' => 'sub1'),
2678
                        ),
2679
                    ),
2680
                    'alwaysAvailable' => false,
2681
                    'isHistory' => false,
2682
                    'isCustom' => false,
2683
                    'forward' => false,
2684
                )
2685
            ),
2686
            $urlAlias
2687
        );
2688
    }
2689
2690
    /**
2691
     * Test for the locationMoved() method.