Code Duplication    Length = 68-68 lines in 2 locations

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

@@ 3545-3612 (lines=68) @@
3542
     *
3543
     * @group swap
3544
     */
3545
    public function testLocationSwappedSiblingsSimple()
3546
    {
3547
        $handler = $this->getHandler();
3548
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_siblings_simple.php');
3549
3550
        $countBeforeReusing = $this->countRows();
3551
3552
        $handler->locationSwapped(314, 2, 315, 2);
3553
3554
        $this->assertEquals(
3555
            $countBeforeReusing,
3556
            $this->countRows()
3557
        );
3558
3559
        $urlAlias = $handler->lookup('jedan');
3560
        $this->assertEquals(
3561
            new UrlAlias(
3562
                array(
3563
                    'id' => '0-' . md5('jedan'),
3564
                    'type' => UrlAlias::LOCATION,
3565
                    'destination' => 315,
3566
                    'languageCodes' => array(
3567
                        'cro-HR',
3568
                    ),
3569
                    'pathData' => array(
3570
                        array(
3571
                            'always-available' => false,
3572
                            'translations' => array(
3573
                                'cro-HR' => 'jedan',
3574
                            ),
3575
                        ),
3576
                    ),
3577
                    'alwaysAvailable' => false,
3578
                    'isHistory' => false,
3579
                    'isCustom' => false,
3580
                    'forward' => false,
3581
                )
3582
            ),
3583
            $urlAlias
3584
        );
3585
3586
        $urlAlias = $handler->lookup('dva');
3587
        $this->assertEquals(
3588
            new UrlAlias(
3589
                array(
3590
                    'id' => '0-' . md5('dva'),
3591
                    'type' => UrlAlias::LOCATION,
3592
                    'destination' => 314,
3593
                    'languageCodes' => array(
3594
                        'cro-HR',
3595
                    ),
3596
                    'pathData' => array(
3597
                        array(
3598
                            'always-available' => false,
3599
                            'translations' => array(
3600
                                'cro-HR' => 'dva',
3601
                            ),
3602
                        ),
3603
                    ),
3604
                    'alwaysAvailable' => false,
3605
                    'isHistory' => false,
3606
                    'isCustom' => false,
3607
                    'forward' => false,
3608
                )
3609
            ),
3610
            $urlAlias
3611
        );
3612
    }
3613
3614
    /**
3615
     * Test for the locationSwapped() method.
@@ 3619-3686 (lines=68) @@
3616
     *
3617
     * @group swap
3618
     */
3619
    public function testLocationSwappedSiblingsSimpleReverse()
3620
    {
3621
        $handler = $this->getHandler();
3622
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_siblings_simple.php');
3623
3624
        $countBeforeReusing = $this->countRows();
3625
3626
        $handler->locationSwapped(315, 2, 314, 2);
3627
3628
        $this->assertEquals(
3629
            $countBeforeReusing,
3630
            $this->countRows()
3631
        );
3632
3633
        $urlAlias = $handler->lookup('jedan');
3634
        $this->assertEquals(
3635
            new UrlAlias(
3636
                array(
3637
                    'id' => '0-' . md5('jedan'),
3638
                    'type' => UrlAlias::LOCATION,
3639
                    'destination' => 315,
3640
                    'languageCodes' => array(
3641
                        'cro-HR',
3642
                    ),
3643
                    'pathData' => array(
3644
                        array(
3645
                            'always-available' => false,
3646
                            'translations' => array(
3647
                                'cro-HR' => 'jedan',
3648
                            ),
3649
                        ),
3650
                    ),
3651
                    'alwaysAvailable' => false,
3652
                    'isHistory' => false,
3653
                    'isCustom' => false,
3654
                    'forward' => false,
3655
                )
3656
            ),
3657
            $urlAlias
3658
        );
3659
3660
        $urlAlias = $handler->lookup('dva');
3661
        $this->assertEquals(
3662
            new UrlAlias(
3663
                array(
3664
                    'id' => '0-' . md5('dva'),
3665
                    'type' => UrlAlias::LOCATION,
3666
                    'destination' => 314,
3667
                    'languageCodes' => array(
3668
                        'cro-HR',
3669
                    ),
3670
                    'pathData' => array(
3671
                        array(
3672
                            'always-available' => false,
3673
                            'translations' => array(
3674
                                'cro-HR' => 'dva',
3675
                            ),
3676
                        ),
3677
                    ),
3678
                    'alwaysAvailable' => false,
3679
                    'isHistory' => false,
3680
                    'isCustom' => false,
3681
                    'forward' => false,
3682
                )
3683
            ),
3684
            $urlAlias
3685
        );
3686
    }
3687
3688
    /**
3689
     * Test for the locationSwapped() method.