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