Code Duplication    Length = 68-68 lines in 2 locations

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

@@ 3477-3544 (lines=68) @@
3474
     *
3475
     * @group swap
3476
     */
3477
    public function testLocationSwappedSiblingsSimple()
3478
    {
3479
        $handler = $this->getHandler();
3480
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_siblings_simple.php');
3481
3482
        $countBeforeReusing = $this->countRows();
3483
3484
        $handler->locationSwapped(314, 2, 315, 2);
3485
3486
        $this->assertEquals(
3487
            $countBeforeReusing,
3488
            $this->countRows()
3489
        );
3490
3491
        $urlAlias = $handler->lookup('jedan');
3492
        $this->assertEquals(
3493
            new UrlAlias(
3494
                array(
3495
                    'id' => '0-' . md5('jedan'),
3496
                    'type' => UrlAlias::LOCATION,
3497
                    'destination' => 315,
3498
                    'languageCodes' => array(
3499
                        'cro-HR',
3500
                    ),
3501
                    'pathData' => array(
3502
                        array(
3503
                            'always-available' => false,
3504
                            'translations' => array(
3505
                                'cro-HR' => 'jedan',
3506
                            ),
3507
                        ),
3508
                    ),
3509
                    'alwaysAvailable' => false,
3510
                    'isHistory' => false,
3511
                    'isCustom' => false,
3512
                    'forward' => false,
3513
                )
3514
            ),
3515
            $urlAlias
3516
        );
3517
3518
        $urlAlias = $handler->lookup('dva');
3519
        $this->assertEquals(
3520
            new UrlAlias(
3521
                array(
3522
                    'id' => '0-' . md5('dva'),
3523
                    'type' => UrlAlias::LOCATION,
3524
                    'destination' => 314,
3525
                    'languageCodes' => array(
3526
                        'cro-HR',
3527
                    ),
3528
                    'pathData' => array(
3529
                        array(
3530
                            'always-available' => false,
3531
                            'translations' => array(
3532
                                'cro-HR' => 'dva',
3533
                            ),
3534
                        ),
3535
                    ),
3536
                    'alwaysAvailable' => false,
3537
                    'isHistory' => false,
3538
                    'isCustom' => false,
3539
                    'forward' => false,
3540
                )
3541
            ),
3542
            $urlAlias
3543
        );
3544
    }
3545
3546
    /**
3547
     * Test for the locationSwapped() method.
@@ 3551-3618 (lines=68) @@
3548
     *
3549
     * @group swap
3550
     */
3551
    public function testLocationSwappedSiblingsSimpleReverse()
3552
    {
3553
        $handler = $this->getHandler();
3554
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_siblings_simple.php');
3555
3556
        $countBeforeReusing = $this->countRows();
3557
3558
        $handler->locationSwapped(315, 2, 314, 2);
3559
3560
        $this->assertEquals(
3561
            $countBeforeReusing,
3562
            $this->countRows()
3563
        );
3564
3565
        $urlAlias = $handler->lookup('jedan');
3566
        $this->assertEquals(
3567
            new UrlAlias(
3568
                array(
3569
                    'id' => '0-' . md5('jedan'),
3570
                    'type' => UrlAlias::LOCATION,
3571
                    'destination' => 315,
3572
                    'languageCodes' => array(
3573
                        'cro-HR',
3574
                    ),
3575
                    'pathData' => array(
3576
                        array(
3577
                            'always-available' => false,
3578
                            'translations' => array(
3579
                                'cro-HR' => 'jedan',
3580
                            ),
3581
                        ),
3582
                    ),
3583
                    'alwaysAvailable' => false,
3584
                    'isHistory' => false,
3585
                    'isCustom' => false,
3586
                    'forward' => false,
3587
                )
3588
            ),
3589
            $urlAlias
3590
        );
3591
3592
        $urlAlias = $handler->lookup('dva');
3593
        $this->assertEquals(
3594
            new UrlAlias(
3595
                array(
3596
                    'id' => '0-' . md5('dva'),
3597
                    'type' => UrlAlias::LOCATION,
3598
                    'destination' => 314,
3599
                    'languageCodes' => array(
3600
                        'cro-HR',
3601
                    ),
3602
                    'pathData' => array(
3603
                        array(
3604
                            'always-available' => false,
3605
                            'translations' => array(
3606
                                'cro-HR' => 'dva',
3607
                            ),
3608
                        ),
3609
                    ),
3610
                    'alwaysAvailable' => false,
3611
                    'isHistory' => false,
3612
                    'isCustom' => false,
3613
                    'forward' => false,
3614
                )
3615
            ),
3616
            $urlAlias
3617
        );
3618
    }
3619
3620
    /**
3621
     * Test for the locationSwapped() method.