| @@ 2490-2532 (lines=43) @@ | ||
| 2487 | * |
|
| 2488 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved |
|
| 2489 | */ |
|
| 2490 | public function testLocationMovedReparentSubtree() |
|
| 2491 | { |
|
| 2492 | $handler = $this->getHandler(); |
|
| 2493 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_move.php'); |
|
| 2494 | ||
| 2495 | $handler->publishUrlAliasForLocation(4, 3, 'move-this', 'eng-GB', false); |
|
| 2496 | $handler->locationMoved(4, 2, 3); |
|
| 2497 | ||
| 2498 | $urlAlias = $handler->lookup('move-here/move-this/sub1/sub2'); |
|
| 2499 | self::assertEquals( |
|
| 2500 | new UrlAlias( |
|
| 2501 | array( |
|
| 2502 | 'id' => '5-' . md5('sub2'), |
|
| 2503 | 'type' => UrlAlias::LOCATION, |
|
| 2504 | 'destination' => '6', |
|
| 2505 | 'languageCodes' => array('eng-GB'), |
|
| 2506 | 'pathData' => array( |
|
| 2507 | array( |
|
| 2508 | 'always-available' => false, |
|
| 2509 | 'translations' => array('eng-GB' => 'move-here'), |
|
| 2510 | ), |
|
| 2511 | array( |
|
| 2512 | 'always-available' => false, |
|
| 2513 | 'translations' => array('eng-GB' => 'move-this'), |
|
| 2514 | ), |
|
| 2515 | array( |
|
| 2516 | 'always-available' => false, |
|
| 2517 | 'translations' => array('eng-GB' => 'sub1'), |
|
| 2518 | ), |
|
| 2519 | array( |
|
| 2520 | 'always-available' => false, |
|
| 2521 | 'translations' => array('eng-GB' => 'sub2'), |
|
| 2522 | ), |
|
| 2523 | ), |
|
| 2524 | 'alwaysAvailable' => false, |
|
| 2525 | 'isHistory' => false, |
|
| 2526 | 'isCustom' => false, |
|
| 2527 | 'forward' => false, |
|
| 2528 | ) |
|
| 2529 | ), |
|
| 2530 | $urlAlias |
|
| 2531 | ); |
|
| 2532 | } |
|
| 2533 | ||
| 2534 | /** |
|
| 2535 | * Test for the locationMoved() method. |
|
| @@ 2539-2581 (lines=43) @@ | ||
| 2536 | * |
|
| 2537 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved |
|
| 2538 | */ |
|
| 2539 | public function testLocationMovedReparentSubtreeHistory() |
|
| 2540 | { |
|
| 2541 | $handler = $this->getHandler(); |
|
| 2542 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_move.php'); |
|
| 2543 | ||
| 2544 | $handler->publishUrlAliasForLocation(4, 3, 'move-this', 'eng-GB', false); |
|
| 2545 | $handler->locationMoved(4, 2, 3); |
|
| 2546 | ||
| 2547 | $urlAlias = $handler->lookup('move-here/move-this/sub1/sub2-history'); |
|
| 2548 | self::assertEquals( |
|
| 2549 | new UrlAlias( |
|
| 2550 | array( |
|
| 2551 | 'id' => '5-' . md5('sub2-history'), |
|
| 2552 | 'type' => UrlAlias::LOCATION, |
|
| 2553 | 'destination' => '6', |
|
| 2554 | 'languageCodes' => array('eng-GB'), |
|
| 2555 | 'pathData' => array( |
|
| 2556 | array( |
|
| 2557 | 'always-available' => false, |
|
| 2558 | 'translations' => array('eng-GB' => 'move-here'), |
|
| 2559 | ), |
|
| 2560 | array( |
|
| 2561 | 'always-available' => false, |
|
| 2562 | 'translations' => array('eng-GB' => 'move-this'), |
|
| 2563 | ), |
|
| 2564 | array( |
|
| 2565 | 'always-available' => false, |
|
| 2566 | 'translations' => array('eng-GB' => 'sub1'), |
|
| 2567 | ), |
|
| 2568 | array( |
|
| 2569 | 'always-available' => false, |
|
| 2570 | 'translations' => array('eng-GB' => 'sub2-history'), |
|
| 2571 | ), |
|
| 2572 | ), |
|
| 2573 | 'alwaysAvailable' => false, |
|
| 2574 | 'isHistory' => true, |
|
| 2575 | 'isCustom' => false, |
|
| 2576 | 'forward' => false, |
|
| 2577 | ) |
|
| 2578 | ), |
|
| 2579 | $urlAlias |
|
| 2580 | ); |
|
| 2581 | } |
|
| 2582 | ||
| 2583 | /** |
|
| 2584 | * Test for the locationCopied() method. |
|