Code Duplication    Length = 68-68 lines in 2 locations

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

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