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