Code Duplication    Length = 68-68 lines in 2 locations

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

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