| @@ 1052-1085 (lines=34) @@ | ||
| 1049 | * @depends testLookupLocationUrlAlias |
|
| 1050 | * @group publish |
|
| 1051 | */ |
|
| 1052 | public function testPublishUrlAliasForLocation() |
|
| 1053 | { |
|
| 1054 | $handler = $this->getHandler(); |
|
| 1055 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); |
|
| 1056 | ||
| 1057 | $handler->publishUrlAliasForLocation(314, 2, 'simple', 'eng-GB', true); |
|
| 1058 | $publishedUrlAlias = $handler->lookup('simple'); |
|
| 1059 | ||
| 1060 | self::assertEquals(4, $this->countRows()); |
|
| 1061 | self::assertEquals( |
|
| 1062 | new UrlAlias( |
|
| 1063 | array( |
|
| 1064 | 'id' => '0-' . md5('simple'), |
|
| 1065 | 'type' => UrlAlias::LOCATION, |
|
| 1066 | 'destination' => 314, |
|
| 1067 | 'languageCodes' => array('eng-GB'), |
|
| 1068 | 'pathData' => array( |
|
| 1069 | array( |
|
| 1070 | 'always-available' => true, |
|
| 1071 | 'translations' => array( |
|
| 1072 | 'eng-GB' => 'simple', |
|
| 1073 | 'cro-HR' => 'path314', |
|
| 1074 | ), |
|
| 1075 | ), |
|
| 1076 | ), |
|
| 1077 | 'alwaysAvailable' => true, |
|
| 1078 | 'isHistory' => false, |
|
| 1079 | 'isCustom' => false, |
|
| 1080 | 'forward' => false, |
|
| 1081 | ) |
|
| 1082 | ), |
|
| 1083 | $publishedUrlAlias |
|
| 1084 | ); |
|
| 1085 | } |
|
| 1086 | ||
| 1087 | /** |
|
| 1088 | * Test for the publishUrlAliasForLocation() method. |
|
| @@ 1122-1155 (lines=34) @@ | ||
| 1119 | * @depends testPublishUrlAliasForLocation |
|
| 1120 | * @group publish |
|
| 1121 | */ |
|
| 1122 | public function testPublishUrlAliasCreatesUniqueAlias() |
|
| 1123 | { |
|
| 1124 | $handler = $this->getHandler(); |
|
| 1125 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); |
|
| 1126 | ||
| 1127 | $handler->publishUrlAliasForLocation(314, 2, 'simple', 'eng-GB', true); |
|
| 1128 | $handler->publishUrlAliasForLocation(315, 2, 'simple', 'eng-GB', true); |
|
| 1129 | self::assertEquals(5, $this->countRows()); |
|
| 1130 | ||
| 1131 | $urlAlias = $handler->lookup('simple2'); |
|
| 1132 | self::assertEquals( |
|
| 1133 | new UrlAlias( |
|
| 1134 | array( |
|
| 1135 | 'id' => '0-' . md5('simple2'), |
|
| 1136 | 'type' => UrlAlias::LOCATION, |
|
| 1137 | 'destination' => 315, |
|
| 1138 | 'languageCodes' => array('eng-GB'), |
|
| 1139 | 'pathData' => array( |
|
| 1140 | array( |
|
| 1141 | 'always-available' => true, |
|
| 1142 | 'translations' => array( |
|
| 1143 | 'eng-GB' => 'simple2', |
|
| 1144 | ), |
|
| 1145 | ), |
|
| 1146 | ), |
|
| 1147 | 'alwaysAvailable' => true, |
|
| 1148 | 'isHistory' => false, |
|
| 1149 | 'isCustom' => false, |
|
| 1150 | 'forward' => false, |
|
| 1151 | ) |
|
| 1152 | ), |
|
| 1153 | $urlAlias |
|
| 1154 | ); |
|
| 1155 | } |
|
| 1156 | ||
| 1157 | /** |
|
| 1158 | * @return array |
|
| @@ 2309-2339 (lines=31) @@ | ||
| 2306 | * |
|
| 2307 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved |
|
| 2308 | */ |
|
| 2309 | public function testLocationMovedHistorize() |
|
| 2310 | { |
|
| 2311 | $handler = $this->getHandler(); |
|
| 2312 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_move.php'); |
|
| 2313 | ||
| 2314 | $handler->publishUrlAliasForLocation(4, 3, 'move-this', 'eng-GB', false); |
|
| 2315 | $handler->locationMoved(4, 2, 3); |
|
| 2316 | ||
| 2317 | $urlAlias = $handler->lookup('move-this'); |
|
| 2318 | self::assertEquals( |
|
| 2319 | new UrlAlias( |
|
| 2320 | array( |
|
| 2321 | 'id' => '0-' . md5('move-this'), |
|
| 2322 | 'type' => UrlAlias::LOCATION, |
|
| 2323 | 'destination' => '4', |
|
| 2324 | 'languageCodes' => array('eng-GB'), |
|
| 2325 | 'pathData' => array( |
|
| 2326 | array( |
|
| 2327 | 'always-available' => false, |
|
| 2328 | 'translations' => array('eng-GB' => 'move-this'), |
|
| 2329 | ), |
|
| 2330 | ), |
|
| 2331 | 'alwaysAvailable' => false, |
|
| 2332 | 'isHistory' => true, |
|
| 2333 | 'isCustom' => false, |
|
| 2334 | 'forward' => false, |
|
| 2335 | ) |
|
| 2336 | ), |
|
| 2337 | $urlAlias |
|
| 2338 | ); |
|
| 2339 | } |
|
| 2340 | ||
| 2341 | /** |
|
| 2342 | * Test for the locationMoved() method. |
|
| @@ 2346-2376 (lines=31) @@ | ||
| 2343 | * |
|
| 2344 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved |
|
| 2345 | */ |
|
| 2346 | public function testLocationMovedHistory() |
|
| 2347 | { |
|
| 2348 | $handler = $this->getHandler(); |
|
| 2349 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_move.php'); |
|
| 2350 | ||
| 2351 | $handler->publishUrlAliasForLocation(4, 3, 'move-this', 'eng-GB', false); |
|
| 2352 | $handler->locationMoved(4, 2, 3); |
|
| 2353 | ||
| 2354 | $urlAlias = $handler->lookup('move-this-history'); |
|
| 2355 | self::assertEquals( |
|
| 2356 | new UrlAlias( |
|
| 2357 | array( |
|
| 2358 | 'id' => '0-' . md5('move-this-history'), |
|
| 2359 | 'type' => UrlAlias::LOCATION, |
|
| 2360 | 'destination' => '4', |
|
| 2361 | 'languageCodes' => array('eng-GB'), |
|
| 2362 | 'pathData' => array( |
|
| 2363 | array( |
|
| 2364 | 'always-available' => false, |
|
| 2365 | 'translations' => array('eng-GB' => 'move-this-history'), |
|
| 2366 | ), |
|
| 2367 | ), |
|
| 2368 | 'alwaysAvailable' => false, |
|
| 2369 | 'isHistory' => true, |
|
| 2370 | 'isCustom' => false, |
|
| 2371 | 'forward' => false, |
|
| 2372 | ) |
|
| 2373 | ), |
|
| 2374 | $urlAlias |
|
| 2375 | ); |
|
| 2376 | } |
|
| 2377 | ||
| 2378 | /** |
|
| 2379 | * Test for the locationMoved() method. |
|