| @@ 2223-2262 (lines=40) @@ | ||
| 2220 | * @group create |
|
| 2221 | * @group custom |
|
| 2222 | */ |
|
| 2223 | public function testCreateCustomUrlAliasReusesHistory() |
|
| 2224 | { |
|
| 2225 | $handler = $this->getHandler(); |
|
| 2226 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php'); |
|
| 2227 | ||
| 2228 | $countBeforeReusing = $this->countRows(); |
|
| 2229 | $handler->createCustomUrlAlias( |
|
| 2230 | 314, |
|
| 2231 | 'history-hello', |
|
| 2232 | true, |
|
| 2233 | 'eng-GB', |
|
| 2234 | true |
|
| 2235 | ); |
|
| 2236 | ||
| 2237 | self::assertEquals( |
|
| 2238 | $countBeforeReusing, |
|
| 2239 | $this->countRows() |
|
| 2240 | ); |
|
| 2241 | self::assertEquals( |
|
| 2242 | new UrlAlias( |
|
| 2243 | [ |
|
| 2244 | 'id' => '0-da94285592c46d4396d3ca6904a4aa8f', |
|
| 2245 | 'type' => UrlAlias::LOCATION, |
|
| 2246 | 'destination' => 314, |
|
| 2247 | 'languageCodes' => ['eng-GB'], |
|
| 2248 | 'pathData' => [ |
|
| 2249 | [ |
|
| 2250 | 'always-available' => true, |
|
| 2251 | 'translations' => ['eng-GB' => 'history-hello'], |
|
| 2252 | ], |
|
| 2253 | ], |
|
| 2254 | 'alwaysAvailable' => true, |
|
| 2255 | 'isHistory' => false, |
|
| 2256 | 'isCustom' => true, |
|
| 2257 | 'forward' => true, |
|
| 2258 | ] |
|
| 2259 | ), |
|
| 2260 | $handler->lookup('history-hello') |
|
| 2261 | ); |
|
| 2262 | } |
|
| 2263 | ||
| 2264 | /** |
|
| 2265 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::createUrlAlias |
|
| @@ 2323-2362 (lines=40) @@ | ||
| 2320 | * @group create |
|
| 2321 | * @group custom |
|
| 2322 | */ |
|
| 2323 | public function testCreateCustomUrlAliasReusesHistoryOfDifferentLanguage() |
|
| 2324 | { |
|
| 2325 | $handler = $this->getHandler(); |
|
| 2326 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php'); |
|
| 2327 | ||
| 2328 | $countBeforeReusing = $this->countRows(); |
|
| 2329 | $handler->createCustomUrlAlias( |
|
| 2330 | 314, |
|
| 2331 | 'history-hello', |
|
| 2332 | true, |
|
| 2333 | 'cro-HR', |
|
| 2334 | true |
|
| 2335 | ); |
|
| 2336 | ||
| 2337 | self::assertEquals( |
|
| 2338 | $countBeforeReusing, |
|
| 2339 | $this->countRows() |
|
| 2340 | ); |
|
| 2341 | self::assertEquals( |
|
| 2342 | new UrlAlias( |
|
| 2343 | [ |
|
| 2344 | 'id' => '0-da94285592c46d4396d3ca6904a4aa8f', |
|
| 2345 | 'type' => UrlAlias::LOCATION, |
|
| 2346 | 'destination' => 314, |
|
| 2347 | 'languageCodes' => ['cro-HR'], |
|
| 2348 | 'pathData' => [ |
|
| 2349 | [ |
|
| 2350 | 'always-available' => true, |
|
| 2351 | 'translations' => ['cro-HR' => 'history-hello'], |
|
| 2352 | ], |
|
| 2353 | ], |
|
| 2354 | 'alwaysAvailable' => true, |
|
| 2355 | 'isHistory' => false, |
|
| 2356 | 'isCustom' => true, |
|
| 2357 | 'forward' => true, |
|
| 2358 | ] |
|
| 2359 | ), |
|
| 2360 | $handler->lookup('history-hello') |
|
| 2361 | ); |
|
| 2362 | } |
|
| 2363 | ||
| 2364 | /** |
|
| 2365 | * Test for the createUrlAlias() method. |
|