| @@ 1066-1099 (lines=34) @@ | ||
| 1063 | * @depends testLookupLocationUrlAlias |
|
| 1064 | * @group publish |
|
| 1065 | */ |
|
| 1066 | public function testPublishUrlAliasForLocation() |
|
| 1067 | { |
|
| 1068 | $handler = $this->getHandler(); |
|
| 1069 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); |
|
| 1070 | ||
| 1071 | $handler->publishUrlAliasForLocation(314, 2, 'simple', 'eng-GB', true); |
|
| 1072 | $publishedUrlAlias = $handler->lookup('simple'); |
|
| 1073 | ||
| 1074 | self::assertEquals(4, $this->countRows()); |
|
| 1075 | self::assertEquals( |
|
| 1076 | new UrlAlias( |
|
| 1077 | array( |
|
| 1078 | 'id' => '0-' . md5('simple'), |
|
| 1079 | 'type' => UrlAlias::LOCATION, |
|
| 1080 | 'destination' => 314, |
|
| 1081 | 'languageCodes' => array('eng-GB'), |
|
| 1082 | 'pathData' => array( |
|
| 1083 | array( |
|
| 1084 | 'always-available' => true, |
|
| 1085 | 'translations' => array( |
|
| 1086 | 'eng-GB' => 'simple', |
|
| 1087 | 'cro-HR' => 'path314', |
|
| 1088 | ), |
|
| 1089 | ), |
|
| 1090 | ), |
|
| 1091 | 'alwaysAvailable' => true, |
|
| 1092 | 'isHistory' => false, |
|
| 1093 | 'isCustom' => false, |
|
| 1094 | 'forward' => false, |
|
| 1095 | ) |
|
| 1096 | ), |
|
| 1097 | $publishedUrlAlias |
|
| 1098 | ); |
|
| 1099 | } |
|
| 1100 | ||
| 1101 | /** |
|
| 1102 | * Test for the publishUrlAliasForLocation() method. |
|
| @@ 1136-1169 (lines=34) @@ | ||
| 1133 | * @depends testPublishUrlAliasForLocation |
|
| 1134 | * @group publish |
|
| 1135 | */ |
|
| 1136 | public function testPublishUrlAliasCreatesUniqueAlias() |
|
| 1137 | { |
|
| 1138 | $handler = $this->getHandler(); |
|
| 1139 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); |
|
| 1140 | ||
| 1141 | $handler->publishUrlAliasForLocation(314, 2, 'simple', 'eng-GB', true); |
|
| 1142 | $handler->publishUrlAliasForLocation(315, 2, 'simple', 'eng-GB', true); |
|
| 1143 | self::assertEquals(5, $this->countRows()); |
|
| 1144 | ||
| 1145 | $urlAlias = $handler->lookup('simple2'); |
|
| 1146 | self::assertEquals( |
|
| 1147 | new UrlAlias( |
|
| 1148 | array( |
|
| 1149 | 'id' => '0-' . md5('simple2'), |
|
| 1150 | 'type' => UrlAlias::LOCATION, |
|
| 1151 | 'destination' => 315, |
|
| 1152 | 'languageCodes' => array('eng-GB'), |
|
| 1153 | 'pathData' => array( |
|
| 1154 | array( |
|
| 1155 | 'always-available' => true, |
|
| 1156 | 'translations' => array( |
|
| 1157 | 'eng-GB' => 'simple2', |
|
| 1158 | ), |
|
| 1159 | ), |
|
| 1160 | ), |
|
| 1161 | 'alwaysAvailable' => true, |
|
| 1162 | 'isHistory' => false, |
|
| 1163 | 'isCustom' => false, |
|
| 1164 | 'forward' => false, |
|
| 1165 | ) |
|
| 1166 | ), |
|
| 1167 | $urlAlias |
|
| 1168 | ); |
|
| 1169 | } |
|
| 1170 | ||
| 1171 | /** |
|
| 1172 | * @return array |
|
| @@ 2529-2559 (lines=31) @@ | ||
| 2526 | * |
|
| 2527 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved |
|
| 2528 | */ |
|
| 2529 | public function testLocationMovedHistorize() |
|
| 2530 | { |
|
| 2531 | $handler = $this->getHandler(); |
|
| 2532 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_move.php'); |
|
| 2533 | ||
| 2534 | $handler->publishUrlAliasForLocation(4, 3, 'move-this', 'eng-GB', false); |
|
| 2535 | $handler->locationMoved(4, 2, 3); |
|
| 2536 | ||
| 2537 | $urlAlias = $handler->lookup('move-this'); |
|
| 2538 | self::assertEquals( |
|
| 2539 | new UrlAlias( |
|
| 2540 | array( |
|
| 2541 | 'id' => '0-' . md5('move-this'), |
|
| 2542 | 'type' => UrlAlias::LOCATION, |
|
| 2543 | 'destination' => '4', |
|
| 2544 | 'languageCodes' => array('eng-GB'), |
|
| 2545 | 'pathData' => array( |
|
| 2546 | array( |
|
| 2547 | 'always-available' => false, |
|
| 2548 | 'translations' => array('eng-GB' => 'move-this'), |
|
| 2549 | ), |
|
| 2550 | ), |
|
| 2551 | 'alwaysAvailable' => false, |
|
| 2552 | 'isHistory' => true, |
|
| 2553 | 'isCustom' => false, |
|
| 2554 | 'forward' => false, |
|
| 2555 | ) |
|
| 2556 | ), |
|
| 2557 | $urlAlias |
|
| 2558 | ); |
|
| 2559 | } |
|
| 2560 | ||
| 2561 | /** |
|
| 2562 | * Test for the locationMoved() method. |
|
| @@ 2566-2596 (lines=31) @@ | ||
| 2563 | * |
|
| 2564 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved |
|
| 2565 | */ |
|
| 2566 | public function testLocationMovedHistory() |
|
| 2567 | { |
|
| 2568 | $handler = $this->getHandler(); |
|
| 2569 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_move.php'); |
|
| 2570 | ||
| 2571 | $handler->publishUrlAliasForLocation(4, 3, 'move-this', 'eng-GB', false); |
|
| 2572 | $handler->locationMoved(4, 2, 3); |
|
| 2573 | ||
| 2574 | $urlAlias = $handler->lookup('move-this-history'); |
|
| 2575 | self::assertEquals( |
|
| 2576 | new UrlAlias( |
|
| 2577 | array( |
|
| 2578 | 'id' => '0-' . md5('move-this-history'), |
|
| 2579 | 'type' => UrlAlias::LOCATION, |
|
| 2580 | 'destination' => '4', |
|
| 2581 | 'languageCodes' => array('eng-GB'), |
|
| 2582 | 'pathData' => array( |
|
| 2583 | array( |
|
| 2584 | 'always-available' => false, |
|
| 2585 | 'translations' => array('eng-GB' => 'move-this-history'), |
|
| 2586 | ), |
|
| 2587 | ), |
|
| 2588 | 'alwaysAvailable' => false, |
|
| 2589 | 'isHistory' => true, |
|
| 2590 | 'isCustom' => false, |
|
| 2591 | 'forward' => false, |
|
| 2592 | ) |
|
| 2593 | ), |
|
| 2594 | $urlAlias |
|
| 2595 | ); |
|
| 2596 | } |
|
| 2597 | ||
| 2598 | /** |
|
| 2599 | * Test for the locationMoved() method. |
|