Code Duplication    Length = 68-68 lines in 2 locations

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

@@ 3426-3493 (lines=68) @@
3423
     *
3424
     * @group swap
3425
     */
3426
    public function testLocationSwappedSiblingsSimple()
3427
    {
3428
        $handler = $this->getHandler();
3429
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_siblings_simple.php');
3430
3431
        $countBeforeReusing = $this->countRows();
3432
3433
        $handler->locationSwapped(314, 2, 315, 2);
3434
3435
        $this->assertEquals(
3436
            $countBeforeReusing,
3437
            $this->countRows()
3438
        );
3439
3440
        $urlAlias = $handler->lookup('jedan');
3441
        $this->assertEquals(
3442
            new UrlAlias(
3443
                array(
3444
                    'id' => '0-' . md5('jedan'),
3445
                    'type' => UrlAlias::LOCATION,
3446
                    'destination' => 315,
3447
                    'languageCodes' => array(
3448
                        'cro-HR',
3449
                    ),
3450
                    'pathData' => array(
3451
                        array(
3452
                            'always-available' => false,
3453
                            'translations' => array(
3454
                                'cro-HR' => 'jedan',
3455
                            ),
3456
                        ),
3457
                    ),
3458
                    'alwaysAvailable' => false,
3459
                    'isHistory' => false,
3460
                    'isCustom' => false,
3461
                    'forward' => false,
3462
                )
3463
            ),
3464
            $urlAlias
3465
        );
3466
3467
        $urlAlias = $handler->lookup('dva');
3468
        $this->assertEquals(
3469
            new UrlAlias(
3470
                array(
3471
                    'id' => '0-' . md5('dva'),
3472
                    'type' => UrlAlias::LOCATION,
3473
                    'destination' => 314,
3474
                    'languageCodes' => array(
3475
                        'cro-HR',
3476
                    ),
3477
                    'pathData' => array(
3478
                        array(
3479
                            'always-available' => false,
3480
                            'translations' => array(
3481
                                'cro-HR' => 'dva',
3482
                            ),
3483
                        ),
3484
                    ),
3485
                    'alwaysAvailable' => false,
3486
                    'isHistory' => false,
3487
                    'isCustom' => false,
3488
                    'forward' => false,
3489
                )
3490
            ),
3491
            $urlAlias
3492
        );
3493
    }
3494
3495
    /**
3496
     * Test for the locationSwapped() method.
@@ 3500-3567 (lines=68) @@
3497
     *
3498
     * @group swap
3499
     */
3500
    public function testLocationSwappedSiblingsSimpleReverse()
3501
    {
3502
        $handler = $this->getHandler();
3503
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_siblings_simple.php');
3504
3505
        $countBeforeReusing = $this->countRows();
3506
3507
        $handler->locationSwapped(315, 2, 314, 2);
3508
3509
        $this->assertEquals(
3510
            $countBeforeReusing,
3511
            $this->countRows()
3512
        );
3513
3514
        $urlAlias = $handler->lookup('jedan');
3515
        $this->assertEquals(
3516
            new UrlAlias(
3517
                array(
3518
                    'id' => '0-' . md5('jedan'),
3519
                    'type' => UrlAlias::LOCATION,
3520
                    'destination' => 315,
3521
                    'languageCodes' => array(
3522
                        'cro-HR',
3523
                    ),
3524
                    'pathData' => array(
3525
                        array(
3526
                            'always-available' => false,
3527
                            'translations' => array(
3528
                                'cro-HR' => 'jedan',
3529
                            ),
3530
                        ),
3531
                    ),
3532
                    'alwaysAvailable' => false,
3533
                    'isHistory' => false,
3534
                    'isCustom' => false,
3535
                    'forward' => false,
3536
                )
3537
            ),
3538
            $urlAlias
3539
        );
3540
3541
        $urlAlias = $handler->lookup('dva');
3542
        $this->assertEquals(
3543
            new UrlAlias(
3544
                array(
3545
                    'id' => '0-' . md5('dva'),
3546
                    'type' => UrlAlias::LOCATION,
3547
                    'destination' => 314,
3548
                    'languageCodes' => array(
3549
                        'cro-HR',
3550
                    ),
3551
                    'pathData' => array(
3552
                        array(
3553
                            'always-available' => false,
3554
                            'translations' => array(
3555
                                'cro-HR' => 'dva',
3556
                            ),
3557
                        ),
3558
                    ),
3559
                    'alwaysAvailable' => false,
3560
                    'isHistory' => false,
3561
                    'isCustom' => false,
3562
                    'forward' => false,
3563
                )
3564
            ),
3565
            $urlAlias
3566
        );
3567
    }
3568
3569
    /**
3570
     * Test for the locationSwapped() method.