@@ 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 |
|
@@ 2588-2618 (lines=31) @@ | ||
2585 | * |
|
2586 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved |
|
2587 | */ |
|
2588 | public function testLocationMovedHistorize() |
|
2589 | { |
|
2590 | $handler = $this->getHandler(); |
|
2591 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_move.php'); |
|
2592 | ||
2593 | $handler->publishUrlAliasForLocation(4, 3, 'move-this', 'eng-GB', false); |
|
2594 | $handler->locationMoved(4, 2, 3); |
|
2595 | ||
2596 | $urlAlias = $handler->lookup('move-this'); |
|
2597 | self::assertEquals( |
|
2598 | new UrlAlias( |
|
2599 | [ |
|
2600 | 'id' => '0-' . md5('move-this'), |
|
2601 | 'type' => UrlAlias::LOCATION, |
|
2602 | 'destination' => '4', |
|
2603 | 'languageCodes' => ['eng-GB'], |
|
2604 | 'pathData' => [ |
|
2605 | [ |
|
2606 | 'always-available' => false, |
|
2607 | 'translations' => ['eng-GB' => 'move-this'], |
|
2608 | ], |
|
2609 | ], |
|
2610 | 'alwaysAvailable' => false, |
|
2611 | 'isHistory' => true, |
|
2612 | 'isCustom' => false, |
|
2613 | 'forward' => false, |
|
2614 | ] |
|
2615 | ), |
|
2616 | $urlAlias |
|
2617 | ); |
|
2618 | } |
|
2619 | ||
2620 | /** |
|
2621 | * Test for the locationMoved() method. |
|
@@ 2625-2655 (lines=31) @@ | ||
2622 | * |
|
2623 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved |
|
2624 | */ |
|
2625 | public function testLocationMovedHistory() |
|
2626 | { |
|
2627 | $handler = $this->getHandler(); |
|
2628 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_move.php'); |
|
2629 | ||
2630 | $handler->publishUrlAliasForLocation(4, 3, 'move-this', 'eng-GB', false); |
|
2631 | $handler->locationMoved(4, 2, 3); |
|
2632 | ||
2633 | $urlAlias = $handler->lookup('move-this-history'); |
|
2634 | self::assertEquals( |
|
2635 | new UrlAlias( |
|
2636 | [ |
|
2637 | 'id' => '0-' . md5('move-this-history'), |
|
2638 | 'type' => UrlAlias::LOCATION, |
|
2639 | 'destination' => '4', |
|
2640 | 'languageCodes' => ['eng-GB'], |
|
2641 | 'pathData' => [ |
|
2642 | [ |
|
2643 | 'always-available' => false, |
|
2644 | 'translations' => ['eng-GB' => 'move-this-history'], |
|
2645 | ], |
|
2646 | ], |
|
2647 | 'alwaysAvailable' => false, |
|
2648 | 'isHistory' => true, |
|
2649 | 'isCustom' => false, |
|
2650 | 'forward' => false, |
|
2651 | ] |
|
2652 | ), |
|
2653 | $urlAlias |
|
2654 | ); |
|
2655 | } |
|
2656 | ||
2657 | /** |
|
2658 | * Test for the locationMoved() method. |