| @@ 1071-1104 (lines=34) @@ | ||
| 1068 | * @depends testLookupLocationUrlAlias |
|
| 1069 | * @group publish |
|
| 1070 | */ |
|
| 1071 | public function testPublishUrlAliasForLocation() |
|
| 1072 | { |
|
| 1073 | $handler = $this->getHandler(); |
|
| 1074 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); |
|
| 1075 | ||
| 1076 | $handler->publishUrlAliasForLocation(314, 2, 'simple', 'eng-GB', true); |
|
| 1077 | $publishedUrlAlias = $handler->lookup('simple'); |
|
| 1078 | ||
| 1079 | self::assertEquals(4, $this->countRows()); |
|
| 1080 | self::assertEquals( |
|
| 1081 | new UrlAlias( |
|
| 1082 | [ |
|
| 1083 | 'id' => '0-' . md5('simple'), |
|
| 1084 | 'type' => UrlAlias::LOCATION, |
|
| 1085 | 'destination' => 314, |
|
| 1086 | 'languageCodes' => ['eng-GB'], |
|
| 1087 | 'pathData' => [ |
|
| 1088 | [ |
|
| 1089 | 'always-available' => true, |
|
| 1090 | 'translations' => [ |
|
| 1091 | 'eng-GB' => 'simple', |
|
| 1092 | 'cro-HR' => 'path314', |
|
| 1093 | ], |
|
| 1094 | ], |
|
| 1095 | ], |
|
| 1096 | 'alwaysAvailable' => true, |
|
| 1097 | 'isHistory' => false, |
|
| 1098 | 'isCustom' => false, |
|
| 1099 | 'forward' => false, |
|
| 1100 | ] |
|
| 1101 | ), |
|
| 1102 | $publishedUrlAlias |
|
| 1103 | ); |
|
| 1104 | } |
|
| 1105 | ||
| 1106 | /** |
|
| 1107 | * Test for the publishUrlAliasForLocation() method. |
|
| @@ 1141-1174 (lines=34) @@ | ||
| 1138 | * @depends testPublishUrlAliasForLocation |
|
| 1139 | * @group publish |
|
| 1140 | */ |
|
| 1141 | public function testPublishUrlAliasCreatesUniqueAlias() |
|
| 1142 | { |
|
| 1143 | $handler = $this->getHandler(); |
|
| 1144 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); |
|
| 1145 | ||
| 1146 | $handler->publishUrlAliasForLocation(314, 2, 'simple', 'eng-GB', true); |
|
| 1147 | $handler->publishUrlAliasForLocation(315, 2, 'simple', 'eng-GB', true); |
|
| 1148 | self::assertEquals(5, $this->countRows()); |
|
| 1149 | ||
| 1150 | $urlAlias = $handler->lookup('simple2'); |
|
| 1151 | self::assertEquals( |
|
| 1152 | new UrlAlias( |
|
| 1153 | [ |
|
| 1154 | 'id' => '0-' . md5('simple2'), |
|
| 1155 | 'type' => UrlAlias::LOCATION, |
|
| 1156 | 'destination' => 315, |
|
| 1157 | 'languageCodes' => ['eng-GB'], |
|
| 1158 | 'pathData' => [ |
|
| 1159 | [ |
|
| 1160 | 'always-available' => true, |
|
| 1161 | 'translations' => [ |
|
| 1162 | 'eng-GB' => 'simple2', |
|
| 1163 | ], |
|
| 1164 | ], |
|
| 1165 | ], |
|
| 1166 | 'alwaysAvailable' => true, |
|
| 1167 | 'isHistory' => false, |
|
| 1168 | 'isCustom' => false, |
|
| 1169 | 'forward' => false, |
|
| 1170 | ] |
|
| 1171 | ), |
|
| 1172 | $urlAlias |
|
| 1173 | ); |
|
| 1174 | } |
|
| 1175 | ||
| 1176 | /** |
|
| 1177 | * @return array |
|
| @@ 2585-2615 (lines=31) @@ | ||
| 2582 | * |
|
| 2583 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved |
|
| 2584 | */ |
|
| 2585 | public function testLocationMovedHistorize() |
|
| 2586 | { |
|
| 2587 | $handler = $this->getHandler(); |
|
| 2588 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_move.php'); |
|
| 2589 | ||
| 2590 | $handler->publishUrlAliasForLocation(4, 3, 'move-this', 'eng-GB', false); |
|
| 2591 | $handler->locationMoved(4, 2, 3); |
|
| 2592 | ||
| 2593 | $urlAlias = $handler->lookup('move-this'); |
|
| 2594 | self::assertEquals( |
|
| 2595 | new UrlAlias( |
|
| 2596 | [ |
|
| 2597 | 'id' => '0-' . md5('move-this'), |
|
| 2598 | 'type' => UrlAlias::LOCATION, |
|
| 2599 | 'destination' => '4', |
|
| 2600 | 'languageCodes' => ['eng-GB'], |
|
| 2601 | 'pathData' => [ |
|
| 2602 | [ |
|
| 2603 | 'always-available' => false, |
|
| 2604 | 'translations' => ['eng-GB' => 'move-this'], |
|
| 2605 | ], |
|
| 2606 | ], |
|
| 2607 | 'alwaysAvailable' => false, |
|
| 2608 | 'isHistory' => true, |
|
| 2609 | 'isCustom' => false, |
|
| 2610 | 'forward' => false, |
|
| 2611 | ] |
|
| 2612 | ), |
|
| 2613 | $urlAlias |
|
| 2614 | ); |
|
| 2615 | } |
|
| 2616 | ||
| 2617 | /** |
|
| 2618 | * Test for the locationMoved() method. |
|
| @@ 2622-2652 (lines=31) @@ | ||
| 2619 | * |
|
| 2620 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved |
|
| 2621 | */ |
|
| 2622 | public function testLocationMovedHistory() |
|
| 2623 | { |
|
| 2624 | $handler = $this->getHandler(); |
|
| 2625 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_move.php'); |
|
| 2626 | ||
| 2627 | $handler->publishUrlAliasForLocation(4, 3, 'move-this', 'eng-GB', false); |
|
| 2628 | $handler->locationMoved(4, 2, 3); |
|
| 2629 | ||
| 2630 | $urlAlias = $handler->lookup('move-this-history'); |
|
| 2631 | self::assertEquals( |
|
| 2632 | new UrlAlias( |
|
| 2633 | [ |
|
| 2634 | 'id' => '0-' . md5('move-this-history'), |
|
| 2635 | 'type' => UrlAlias::LOCATION, |
|
| 2636 | 'destination' => '4', |
|
| 2637 | 'languageCodes' => ['eng-GB'], |
|
| 2638 | 'pathData' => [ |
|
| 2639 | [ |
|
| 2640 | 'always-available' => false, |
|
| 2641 | 'translations' => ['eng-GB' => 'move-this-history'], |
|
| 2642 | ], |
|
| 2643 | ], |
|
| 2644 | 'alwaysAvailable' => false, |
|
| 2645 | 'isHistory' => true, |
|
| 2646 | 'isCustom' => false, |
|
| 2647 | 'forward' => false, |
|
| 2648 | ] |
|
| 2649 | ), |
|
| 2650 | $urlAlias |
|
| 2651 | ); |
|
| 2652 | } |
|
| 2653 | ||
| 2654 | /** |
|
| 2655 | * Test for the locationMoved() method. |
|