Code Duplication    Length = 68-68 lines in 2 locations

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

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