Code Duplication    Length = 39-39 lines in 2 locations

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

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