| @@ 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 |
|
| @@ 2515-2545 (lines=31) @@ | ||
| 2512 | * |
|
| 2513 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved |
|
| 2514 | */ |
|
| 2515 | public function testLocationMovedHistorize() |
|
| 2516 | { |
|
| 2517 | $handler = $this->getHandler(); |
|
| 2518 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_move.php'); |
|
| 2519 | ||
| 2520 | $handler->publishUrlAliasForLocation(4, 3, 'move-this', 'eng-GB', false); |
|
| 2521 | $handler->locationMoved(4, 2, 3); |
|
| 2522 | ||
| 2523 | $urlAlias = $handler->lookup('move-this'); |
|
| 2524 | self::assertEquals( |
|
| 2525 | new UrlAlias( |
|
| 2526 | array( |
|
| 2527 | 'id' => '0-' . md5('move-this'), |
|
| 2528 | 'type' => UrlAlias::LOCATION, |
|
| 2529 | 'destination' => '4', |
|
| 2530 | 'languageCodes' => array('eng-GB'), |
|
| 2531 | 'pathData' => array( |
|
| 2532 | array( |
|
| 2533 | 'always-available' => false, |
|
| 2534 | 'translations' => array('eng-GB' => 'move-this'), |
|
| 2535 | ), |
|
| 2536 | ), |
|
| 2537 | 'alwaysAvailable' => false, |
|
| 2538 | 'isHistory' => true, |
|
| 2539 | 'isCustom' => false, |
|
| 2540 | 'forward' => false, |
|
| 2541 | ) |
|
| 2542 | ), |
|
| 2543 | $urlAlias |
|
| 2544 | ); |
|
| 2545 | } |
|
| 2546 | ||
| 2547 | /** |
|
| 2548 | * Test for the locationMoved() method. |
|
| @@ 2552-2582 (lines=31) @@ | ||
| 2549 | * |
|
| 2550 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved |
|
| 2551 | */ |
|
| 2552 | public function testLocationMovedHistory() |
|
| 2553 | { |
|
| 2554 | $handler = $this->getHandler(); |
|
| 2555 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_move.php'); |
|
| 2556 | ||
| 2557 | $handler->publishUrlAliasForLocation(4, 3, 'move-this', 'eng-GB', false); |
|
| 2558 | $handler->locationMoved(4, 2, 3); |
|
| 2559 | ||
| 2560 | $urlAlias = $handler->lookup('move-this-history'); |
|
| 2561 | self::assertEquals( |
|
| 2562 | new UrlAlias( |
|
| 2563 | array( |
|
| 2564 | 'id' => '0-' . md5('move-this-history'), |
|
| 2565 | 'type' => UrlAlias::LOCATION, |
|
| 2566 | 'destination' => '4', |
|
| 2567 | 'languageCodes' => array('eng-GB'), |
|
| 2568 | 'pathData' => array( |
|
| 2569 | array( |
|
| 2570 | 'always-available' => false, |
|
| 2571 | 'translations' => array('eng-GB' => 'move-this-history'), |
|
| 2572 | ), |
|
| 2573 | ), |
|
| 2574 | 'alwaysAvailable' => false, |
|
| 2575 | 'isHistory' => true, |
|
| 2576 | 'isCustom' => false, |
|
| 2577 | 'forward' => false, |
|
| 2578 | ) |
|
| 2579 | ), |
|
| 2580 | $urlAlias |
|
| 2581 | ); |
|
| 2582 | } |
|
| 2583 | ||
| 2584 | /** |
|
| 2585 | * Test for the locationMoved() method. |
|