Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like UrlAliasHandlerTest often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use UrlAliasHandlerTest, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 35 | class UrlAliasHandlerTest extends TestCase |
||
| 36 | { |
||
| 37 | /** |
||
| 38 | * Test for the lookup() method. |
||
| 39 | * |
||
| 40 | * Simple lookup case. |
||
| 41 | * |
||
| 42 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::lookup |
||
| 43 | * @group location |
||
| 44 | * @group virtual |
||
| 45 | * @group resource |
||
| 46 | * @group case-correction |
||
| 47 | * @group multiple-languages |
||
| 48 | */ |
||
| 49 | public function testLookup() |
||
| 50 | { |
||
| 51 | $handler = $this->getHandler(); |
||
| 52 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_location.php'); |
||
| 53 | |||
| 54 | $urlAlias = $handler->lookup('jedan'); |
||
| 55 | self::assertInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\UrlAlias', $urlAlias); |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Test for the lookup() method. |
||
| 60 | * |
||
| 61 | * Trying to lookup non existent URL alias throws NotFoundException. |
||
| 62 | * |
||
| 63 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::lookup |
||
| 64 | * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException |
||
| 65 | * @group location |
||
| 66 | * @group virtual |
||
| 67 | * @group resource |
||
| 68 | */ |
||
| 69 | public function testLookupThrowsNotFoundException() |
||
| 70 | { |
||
| 71 | $handler = $this->getHandler(); |
||
| 72 | $handler->lookup('wooden/iron'); |
||
| 73 | } |
||
| 74 | |||
| 75 | public function providerForTestLookupLocationUrlAlias() |
||
| 76 | { |
||
| 77 | return array( |
||
| 78 | array( |
||
| 79 | 'jedan', |
||
| 80 | array( |
||
| 81 | array( |
||
| 82 | 'always-available' => true, |
||
| 83 | 'translations' => array( |
||
| 84 | 'cro-HR' => 'jedan', |
||
| 85 | ), |
||
| 86 | ), |
||
| 87 | ), |
||
| 88 | array('cro-HR'), |
||
| 89 | true, |
||
| 90 | 314, |
||
| 91 | '0-6896260129051a949051c3847c34466f', |
||
| 92 | ), |
||
| 93 | array( |
||
| 94 | 'jedan/dva', |
||
| 95 | array( |
||
| 96 | array( |
||
| 97 | 'always-available' => true, |
||
| 98 | 'translations' => array( |
||
| 99 | 'cro-HR' => 'jedan', |
||
| 100 | ), |
||
| 101 | ), |
||
| 102 | array( |
||
| 103 | 'always-available' => false, |
||
| 104 | 'translations' => array( |
||
| 105 | 'cro-HR' => 'dva', |
||
| 106 | 'eng-GB' => 'two', |
||
| 107 | ), |
||
| 108 | ), |
||
| 109 | ), |
||
| 110 | array('cro-HR'), |
||
| 111 | false, |
||
| 112 | 315, |
||
| 113 | '2-c67ed9a09ab136fae610b6a087d82e21', |
||
| 114 | ), |
||
| 115 | array( |
||
| 116 | 'jedan/two', |
||
| 117 | array( |
||
| 118 | array( |
||
| 119 | 'always-available' => true, |
||
| 120 | 'translations' => array( |
||
| 121 | 'cro-HR' => 'jedan', |
||
| 122 | ), |
||
| 123 | ), |
||
| 124 | array( |
||
| 125 | 'always-available' => false, |
||
| 126 | 'translations' => array( |
||
| 127 | 'cro-HR' => 'dva', |
||
| 128 | 'eng-GB' => 'two', |
||
| 129 | ), |
||
| 130 | ), |
||
| 131 | ), |
||
| 132 | array('eng-GB'), |
||
| 133 | false, |
||
| 134 | 315, |
||
| 135 | '2-b8a9f715dbb64fd5c56e7783c6820a61', |
||
| 136 | ), |
||
| 137 | array( |
||
| 138 | 'jedan/dva/tri', |
||
| 139 | array( |
||
| 140 | array( |
||
| 141 | 'always-available' => true, |
||
| 142 | 'translations' => array( |
||
| 143 | 'cro-HR' => 'jedan', |
||
| 144 | ), |
||
| 145 | ), |
||
| 146 | array( |
||
| 147 | 'always-available' => false, |
||
| 148 | 'translations' => array( |
||
| 149 | 'cro-HR' => 'dva', |
||
| 150 | 'eng-GB' => 'two', |
||
| 151 | ), |
||
| 152 | ), |
||
| 153 | array( |
||
| 154 | 'always-available' => false, |
||
| 155 | 'translations' => array( |
||
| 156 | 'cro-HR' => 'tri', |
||
| 157 | 'eng-GB' => 'three', |
||
| 158 | 'ger-DE' => 'drei', |
||
| 159 | ), |
||
| 160 | ), |
||
| 161 | ), |
||
| 162 | array('cro-HR'), |
||
| 163 | false, |
||
| 164 | 316, |
||
| 165 | '3-d2cfe69af2d64330670e08efb2c86df7', |
||
| 166 | ), |
||
| 167 | array( |
||
| 168 | 'jedan/two/three', |
||
| 169 | array( |
||
| 170 | array( |
||
| 171 | 'always-available' => true, |
||
| 172 | 'translations' => array( |
||
| 173 | 'cro-HR' => 'jedan', |
||
| 174 | ), |
||
| 175 | ), |
||
| 176 | array( |
||
| 177 | 'always-available' => false, |
||
| 178 | 'translations' => array( |
||
| 179 | 'cro-HR' => 'dva', |
||
| 180 | 'eng-GB' => 'two', |
||
| 181 | ), |
||
| 182 | ), |
||
| 183 | array( |
||
| 184 | 'always-available' => false, |
||
| 185 | 'translations' => array( |
||
| 186 | 'cro-HR' => 'tri', |
||
| 187 | 'eng-GB' => 'three', |
||
| 188 | 'ger-DE' => 'drei', |
||
| 189 | ), |
||
| 190 | ), |
||
| 191 | ), |
||
| 192 | array('eng-GB'), |
||
| 193 | false, |
||
| 194 | 316, |
||
| 195 | '3-35d6d33467aae9a2e3dccb4b6b027878', |
||
| 196 | ), |
||
| 197 | array( |
||
| 198 | 'jedan/dva/three', |
||
| 199 | array( |
||
| 200 | array( |
||
| 201 | 'always-available' => true, |
||
| 202 | 'translations' => array( |
||
| 203 | 'cro-HR' => 'jedan', |
||
| 204 | ), |
||
| 205 | ), |
||
| 206 | array( |
||
| 207 | 'always-available' => false, |
||
| 208 | 'translations' => array( |
||
| 209 | 'cro-HR' => 'dva', |
||
| 210 | 'eng-GB' => 'two', |
||
| 211 | ), |
||
| 212 | ), |
||
| 213 | array( |
||
| 214 | 'always-available' => false, |
||
| 215 | 'translations' => array( |
||
| 216 | 'cro-HR' => 'tri', |
||
| 217 | 'eng-GB' => 'three', |
||
| 218 | 'ger-DE' => 'drei', |
||
| 219 | ), |
||
| 220 | ), |
||
| 221 | ), |
||
| 222 | array('eng-GB'), |
||
| 223 | false, |
||
| 224 | 316, |
||
| 225 | '3-35d6d33467aae9a2e3dccb4b6b027878', |
||
| 226 | ), |
||
| 227 | array( |
||
| 228 | 'jedan/two/tri', |
||
| 229 | array( |
||
| 230 | array( |
||
| 231 | 'always-available' => true, |
||
| 232 | 'translations' => array( |
||
| 233 | 'cro-HR' => 'jedan', |
||
| 234 | ), |
||
| 235 | ), |
||
| 236 | array( |
||
| 237 | 'always-available' => false, |
||
| 238 | 'translations' => array( |
||
| 239 | 'cro-HR' => 'dva', |
||
| 240 | 'eng-GB' => 'two', |
||
| 241 | ), |
||
| 242 | ), |
||
| 243 | array( |
||
| 244 | 'always-available' => false, |
||
| 245 | 'translations' => array( |
||
| 246 | 'cro-HR' => 'tri', |
||
| 247 | 'eng-GB' => 'three', |
||
| 248 | 'ger-DE' => 'drei', |
||
| 249 | ), |
||
| 250 | ), |
||
| 251 | ), |
||
| 252 | array('cro-HR'), |
||
| 253 | false, |
||
| 254 | 316, |
||
| 255 | '3-d2cfe69af2d64330670e08efb2c86df7', |
||
| 256 | ), |
||
| 257 | array( |
||
| 258 | 'jedan/dva/drei', |
||
| 259 | array( |
||
| 260 | array( |
||
| 261 | 'always-available' => true, |
||
| 262 | 'translations' => array( |
||
| 263 | 'cro-HR' => 'jedan', |
||
| 264 | ), |
||
| 265 | ), |
||
| 266 | array( |
||
| 267 | 'always-available' => false, |
||
| 268 | 'translations' => array( |
||
| 269 | 'cro-HR' => 'dva', |
||
| 270 | 'eng-GB' => 'two', |
||
| 271 | ), |
||
| 272 | ), |
||
| 273 | array( |
||
| 274 | 'always-available' => false, |
||
| 275 | 'translations' => array( |
||
| 276 | 'cro-HR' => 'tri', |
||
| 277 | 'eng-GB' => 'three', |
||
| 278 | 'ger-DE' => 'drei', |
||
| 279 | ), |
||
| 280 | ), |
||
| 281 | ), |
||
| 282 | array('ger-DE'), |
||
| 283 | false, |
||
| 284 | 316, |
||
| 285 | '3-1d8d2fd0a99802b89eb356a86e029d25', |
||
| 286 | ), |
||
| 287 | array( |
||
| 288 | 'jedan/two/drei', |
||
| 289 | array( |
||
| 290 | array( |
||
| 291 | 'always-available' => true, |
||
| 292 | 'translations' => array( |
||
| 293 | 'cro-HR' => 'jedan', |
||
| 294 | ), |
||
| 295 | ), |
||
| 296 | array( |
||
| 297 | 'always-available' => false, |
||
| 298 | 'translations' => array( |
||
| 299 | 'cro-HR' => 'dva', |
||
| 300 | 'eng-GB' => 'two', |
||
| 301 | ), |
||
| 302 | ), |
||
| 303 | array( |
||
| 304 | 'always-available' => false, |
||
| 305 | 'translations' => array( |
||
| 306 | 'cro-HR' => 'tri', |
||
| 307 | 'eng-GB' => 'three', |
||
| 308 | 'ger-DE' => 'drei', |
||
| 309 | ), |
||
| 310 | ), |
||
| 311 | ), |
||
| 312 | array('ger-DE'), |
||
| 313 | false, |
||
| 314 | 316, |
||
| 315 | '3-1d8d2fd0a99802b89eb356a86e029d25', |
||
| 316 | ), |
||
| 317 | ); |
||
| 318 | } |
||
| 319 | |||
| 320 | /** |
||
| 321 | * Test for the lookup() method. |
||
| 322 | * |
||
| 323 | * Testing that UrlAlias is found and has expected state. |
||
| 324 | * |
||
| 325 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::lookup |
||
| 326 | * @dataProvider providerForTestLookupLocationUrlAlias |
||
| 327 | * @depends testLookup |
||
| 328 | * @group location |
||
| 329 | */ |
||
| 330 | View Code Duplication | public function testLookupLocationUrlAlias( |
|
| 331 | $url, |
||
| 332 | array $pathData, |
||
| 333 | array $languageCodes, |
||
| 334 | $alwaysAvailable, |
||
| 335 | $locationId, |
||
| 336 | $id |
||
| 337 | ) { |
||
| 338 | $handler = $this->getHandler(); |
||
| 339 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_location.php'); |
||
| 340 | |||
| 341 | $urlAlias = $handler->lookup($url); |
||
| 342 | |||
| 343 | self::assertInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\UrlAlias', $urlAlias); |
||
| 344 | self::assertEquals( |
||
| 345 | new UrlAlias( |
||
| 346 | array( |
||
| 347 | 'id' => $id, |
||
| 348 | 'type' => UrlAlias::LOCATION, |
||
| 349 | 'destination' => $locationId, |
||
| 350 | 'languageCodes' => $languageCodes, |
||
| 351 | 'pathData' => $pathData, |
||
| 352 | 'alwaysAvailable' => $alwaysAvailable, |
||
| 353 | 'isHistory' => false, |
||
| 354 | 'isCustom' => false, |
||
| 355 | 'forward' => false, |
||
| 356 | ) |
||
| 357 | ), |
||
| 358 | $urlAlias |
||
| 359 | ); |
||
| 360 | } |
||
| 361 | |||
| 362 | /** |
||
| 363 | * Testing that looking up case incorrect URL results in redirection to case correct path. |
||
| 364 | * |
||
| 365 | * Note that case corrected path is not always equal to case corrected case incorrect path, eg. "JEDAN/TWO/THREE" |
||
| 366 | * will not always redirect to "jedan/two/three". |
||
| 367 | * In some cases, depending on list of prioritized languages and if Content available in the different language |
||
| 368 | * higher in the list of prioritized languages, path showing to that Content will be used. |
||
| 369 | * Example: "JEDAN/TWO/DREI" with "eng-GB" and "ger-DE" as prioritized languages will produce redirection |
||
| 370 | * to the "jedan/two/three", as "eng-GB" is the most prioritized language and Content that URL alias is pointing |
||
| 371 | * to is available in it. |
||
| 372 | * |
||
| 373 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::lookup |
||
| 374 | * @dataProvider providerForTestLookupLocationUrlAlias |
||
| 375 | * @depends testLookup |
||
| 376 | * @group case-correction |
||
| 377 | * @group location |
||
| 378 | * |
||
| 379 | * @todo refactor, only forward pertinent |
||
| 380 | */ |
||
| 381 | View Code Duplication | public function testLookupLocationCaseCorrection( |
|
| 382 | $url, |
||
| 383 | array $pathData, |
||
| 384 | array $languageCodes, |
||
| 385 | $alwaysAvailable, |
||
| 386 | $locationId, |
||
| 387 | $id |
||
| 388 | ) { |
||
| 389 | $handler = $this->getHandler(); |
||
| 390 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_location.php'); |
||
| 391 | |||
| 392 | $urlAlias = $handler->lookup(strtoupper($url)); |
||
| 393 | |||
| 394 | self::assertInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\UrlAlias', $urlAlias); |
||
| 395 | self::assertEquals( |
||
| 396 | new UrlAlias( |
||
| 397 | array( |
||
| 398 | 'id' => $id, |
||
| 399 | 'type' => UrlAlias::LOCATION, |
||
| 400 | 'destination' => $locationId, |
||
| 401 | 'languageCodes' => $languageCodes, |
||
| 402 | 'pathData' => $pathData, |
||
| 403 | 'alwaysAvailable' => $alwaysAvailable, |
||
| 404 | 'isHistory' => false, |
||
| 405 | 'isCustom' => false, |
||
| 406 | 'forward' => false, |
||
| 407 | ) |
||
| 408 | ), |
||
| 409 | $urlAlias |
||
| 410 | ); |
||
| 411 | } |
||
| 412 | |||
| 413 | public function providerForTestLookupLocationMultipleLanguages() |
||
| 414 | { |
||
| 415 | return array( |
||
| 416 | array( |
||
| 417 | 'jedan/dva', |
||
| 418 | array( |
||
| 419 | array( |
||
| 420 | 'always-available' => true, |
||
| 421 | 'translations' => array( |
||
| 422 | 'cro-HR' => 'jedan', |
||
| 423 | ), |
||
| 424 | ), |
||
| 425 | array( |
||
| 426 | 'always-available' => false, |
||
| 427 | 'translations' => array( |
||
| 428 | 'cro-HR' => 'dva', |
||
| 429 | 'eng-GB' => 'dva', |
||
| 430 | ), |
||
| 431 | ), |
||
| 432 | ), |
||
| 433 | array('cro-HR', 'eng-GB'), |
||
| 434 | false, |
||
| 435 | 315, |
||
| 436 | '2-c67ed9a09ab136fae610b6a087d82e21', |
||
| 437 | ), |
||
| 438 | array( |
||
| 439 | 'jedan/dva/tri', |
||
| 440 | array( |
||
| 441 | array( |
||
| 442 | 'always-available' => true, |
||
| 443 | 'translations' => array( |
||
| 444 | 'cro-HR' => 'jedan', |
||
| 445 | ), |
||
| 446 | ), |
||
| 447 | array( |
||
| 448 | 'always-available' => false, |
||
| 449 | 'translations' => array( |
||
| 450 | 'cro-HR' => 'dva', |
||
| 451 | 'eng-GB' => 'dva', |
||
| 452 | ), |
||
| 453 | ), |
||
| 454 | array( |
||
| 455 | 'always-available' => false, |
||
| 456 | 'translations' => array( |
||
| 457 | 'cro-HR' => 'tri', |
||
| 458 | 'eng-GB' => 'three', |
||
| 459 | ), |
||
| 460 | ), |
||
| 461 | ), |
||
| 462 | array('cro-HR'), |
||
| 463 | false, |
||
| 464 | 316, |
||
| 465 | '3-d2cfe69af2d64330670e08efb2c86df7', |
||
| 466 | ), |
||
| 467 | array( |
||
| 468 | 'jedan/dva/three', |
||
| 469 | array( |
||
| 470 | array( |
||
| 471 | 'always-available' => true, |
||
| 472 | 'translations' => array( |
||
| 473 | 'cro-HR' => 'jedan', |
||
| 474 | ), |
||
| 475 | ), |
||
| 476 | array( |
||
| 477 | 'always-available' => false, |
||
| 478 | 'translations' => array( |
||
| 479 | 'cro-HR' => 'dva', |
||
| 480 | 'eng-GB' => 'dva', |
||
| 481 | ), |
||
| 482 | ), |
||
| 483 | array( |
||
| 484 | 'always-available' => false, |
||
| 485 | 'translations' => array( |
||
| 486 | 'cro-HR' => 'tri', |
||
| 487 | 'eng-GB' => 'three', |
||
| 488 | ), |
||
| 489 | ), |
||
| 490 | ), |
||
| 491 | array('eng-GB'), |
||
| 492 | false, |
||
| 493 | 316, |
||
| 494 | '3-35d6d33467aae9a2e3dccb4b6b027878', |
||
| 495 | ), |
||
| 496 | ); |
||
| 497 | } |
||
| 498 | |||
| 499 | /** |
||
| 500 | * Test for the lookup() method. |
||
| 501 | * |
||
| 502 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::lookup |
||
| 503 | * @dataProvider providerForTestLookupLocationMultipleLanguages |
||
| 504 | * @depends testLookup |
||
| 505 | * @group multiple-languages |
||
| 506 | * @group location |
||
| 507 | */ |
||
| 508 | View Code Duplication | public function testLookupLocationMultipleLanguages( |
|
| 509 | $url, |
||
| 510 | array $pathData, |
||
| 511 | array $languageCodes, |
||
| 512 | $alwaysAvailable, |
||
| 513 | $locationId, |
||
| 514 | $id |
||
| 515 | ) { |
||
| 516 | $handler = $this->getHandler(); |
||
| 517 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_location_multilang.php'); |
||
| 518 | |||
| 519 | $urlAlias = $handler->lookup($url); |
||
| 520 | |||
| 521 | self::assertInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\UrlAlias', $urlAlias); |
||
| 522 | self::assertEquals( |
||
| 523 | new UrlAlias( |
||
| 524 | array( |
||
| 525 | 'id' => $id, |
||
| 526 | 'type' => UrlAlias::LOCATION, |
||
| 527 | 'destination' => $locationId, |
||
| 528 | 'languageCodes' => $languageCodes, |
||
| 529 | 'pathData' => $pathData, |
||
| 530 | 'alwaysAvailable' => $alwaysAvailable, |
||
| 531 | 'isHistory' => false, |
||
| 532 | 'isCustom' => false, |
||
| 533 | 'forward' => false, |
||
| 534 | ) |
||
| 535 | ), |
||
| 536 | $urlAlias |
||
| 537 | ); |
||
| 538 | } |
||
| 539 | |||
| 540 | /** |
||
| 541 | * Test for the lookup() method. |
||
| 542 | * |
||
| 543 | * @todo document |
||
| 544 | * |
||
| 545 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::lookup |
||
| 546 | * @depends testLookup |
||
| 547 | * @group history |
||
| 548 | * @group location |
||
| 549 | */ |
||
| 550 | public function testLookupLocationHistoryUrlAlias() |
||
| 551 | { |
||
| 552 | $handler = $this->getHandler(); |
||
| 553 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_location.php'); |
||
| 554 | |||
| 555 | $urlAlias = $handler->lookup('jedan/dva/tri-history'); |
||
| 556 | |||
| 557 | self::assertEquals( |
||
| 558 | $this->getHistoryAlias(), |
||
| 559 | $urlAlias |
||
| 560 | ); |
||
| 561 | } |
||
| 562 | |||
| 563 | public function providerForTestLookupCustomLocationUrlAlias() |
||
| 564 | { |
||
| 565 | return array( |
||
| 566 | array( |
||
| 567 | 'autogenerated-hello/everybody', |
||
| 568 | array( |
||
| 569 | array( |
||
| 570 | 'always-available' => true, |
||
| 571 | 'translations' => array( |
||
| 572 | 'eng-GB' => 'autogenerated-hello', |
||
| 573 | ), |
||
| 574 | ), |
||
| 575 | array( |
||
| 576 | 'always-available' => true, |
||
| 577 | 'translations' => array( |
||
| 578 | 'eng-GB' => 'everybody', |
||
| 579 | ), |
||
| 580 | ), |
||
| 581 | ), |
||
| 582 | array('eng-GB'), |
||
| 583 | false, |
||
| 584 | true, |
||
| 585 | 315, |
||
| 586 | '2-88150d7d17390010ba6222de68bfafb5', |
||
| 587 | ), |
||
| 588 | array( |
||
| 589 | 'hello', |
||
| 590 | array( |
||
| 591 | array( |
||
| 592 | 'always-available' => false, |
||
| 593 | 'translations' => array( |
||
| 594 | 'eng-GB' => 'hello', |
||
| 595 | ), |
||
| 596 | ), |
||
| 597 | ), |
||
| 598 | array('eng-GB'), |
||
| 599 | true, |
||
| 600 | false, |
||
| 601 | 314, |
||
| 602 | '0-5d41402abc4b2a76b9719d911017c592', |
||
| 603 | ), |
||
| 604 | array( |
||
| 605 | 'hello/and/goodbye', |
||
| 606 | array( |
||
| 607 | array( |
||
| 608 | 'always-available' => false, |
||
| 609 | 'translations' => array( |
||
| 610 | 'eng-GB' => 'hello', |
||
| 611 | ), |
||
| 612 | ), |
||
| 613 | array( |
||
| 614 | 'always-available' => true, |
||
| 615 | 'translations' => array( |
||
| 616 | 'always-available' => 'and', |
||
| 617 | ), |
||
| 618 | ), |
||
| 619 | array( |
||
| 620 | 'always-available' => false, |
||
| 621 | 'translations' => array( |
||
| 622 | 'eng-GB' => 'goodbye', |
||
| 623 | ), |
||
| 624 | ), |
||
| 625 | ), |
||
| 626 | array('eng-GB'), |
||
| 627 | true, |
||
| 628 | false, |
||
| 629 | 316, |
||
| 630 | '8-69faab6268350295550de7d587bc323d', |
||
| 631 | ), |
||
| 632 | array( |
||
| 633 | 'hello/everyone', |
||
| 634 | array( |
||
| 635 | array( |
||
| 636 | 'always-available' => false, |
||
| 637 | 'translations' => array( |
||
| 638 | 'eng-GB' => 'hello', |
||
| 639 | ), |
||
| 640 | ), |
||
| 641 | array( |
||
| 642 | 'always-available' => false, |
||
| 643 | 'translations' => array( |
||
| 644 | 'eng-GB' => 'everyone', |
||
| 645 | ), |
||
| 646 | ), |
||
| 647 | ), |
||
| 648 | array('eng-GB'), |
||
| 649 | true, |
||
| 650 | false, |
||
| 651 | 315, |
||
| 652 | '6-ed881bac6397ede33c0a285c9f50bb83', |
||
| 653 | ), |
||
| 654 | array( |
||
| 655 | 'well/ha-ha-ha', |
||
| 656 | array( |
||
| 657 | array( |
||
| 658 | 'always-available' => true, |
||
| 659 | 'translations' => array( |
||
| 660 | 'always-available' => 'well', |
||
| 661 | ), |
||
| 662 | ), |
||
| 663 | array( |
||
| 664 | 'always-available' => false, |
||
| 665 | 'translations' => array( |
||
| 666 | 'eng-GB' => 'ha-ha-ha', |
||
| 667 | ), |
||
| 668 | ), |
||
| 669 | ), |
||
| 670 | array('eng-GB'), |
||
| 671 | false, |
||
| 672 | false, |
||
| 673 | 317, |
||
| 674 | '10-17a197f4bbe127c368b889a67effd1b3', |
||
| 675 | ), |
||
| 676 | ); |
||
| 677 | } |
||
| 678 | |||
| 679 | /** |
||
| 680 | * Test for the lookup() method. |
||
| 681 | * |
||
| 682 | * Testing that UrlAlias is found and has expected state. |
||
| 683 | * |
||
| 684 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::lookup |
||
| 685 | * @dataProvider providerForTestLookupCustomLocationUrlAlias |
||
| 686 | * @depends testLookup |
||
| 687 | * @group location |
||
| 688 | * @group custom |
||
| 689 | */ |
||
| 690 | View Code Duplication | public function testLookupCustomLocationUrlAlias( |
|
| 691 | $url, |
||
| 692 | array $pathData, |
||
| 693 | array $languageCodes, |
||
| 694 | $forward, |
||
| 695 | $alwaysAvailable, |
||
| 696 | $destination, |
||
| 697 | $id |
||
| 698 | ) { |
||
| 699 | $handler = $this->getHandler(); |
||
| 700 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_location_custom.php'); |
||
| 701 | |||
| 702 | $urlAlias = $handler->lookup($url); |
||
| 703 | self::assertInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\UrlAlias', $urlAlias); |
||
| 704 | self::assertEquals( |
||
| 705 | new UrlAlias( |
||
| 706 | array( |
||
| 707 | 'id' => $id, |
||
| 708 | 'type' => UrlAlias::LOCATION, |
||
| 709 | 'destination' => $destination, |
||
| 710 | 'languageCodes' => $languageCodes, |
||
| 711 | 'pathData' => $pathData, |
||
| 712 | 'alwaysAvailable' => $alwaysAvailable, |
||
| 713 | 'isHistory' => false, |
||
| 714 | 'isCustom' => true, |
||
| 715 | 'forward' => $forward, |
||
| 716 | ) |
||
| 717 | ), |
||
| 718 | $urlAlias |
||
| 719 | ); |
||
| 720 | } |
||
| 721 | |||
| 722 | /** |
||
| 723 | * Test for the lookup() method. |
||
| 724 | * |
||
| 725 | * Testing that UrlAlias is found and has expected state. |
||
| 726 | * |
||
| 727 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::lookup |
||
| 728 | * @dataProvider providerForTestLookupCustomLocationUrlAlias |
||
| 729 | * @depends testLookup |
||
| 730 | * @group location |
||
| 731 | * @group custom |
||
| 732 | */ |
||
| 733 | View Code Duplication | public function testLookupCustomLocationUrlAliasCaseCorrection( |
|
| 734 | $url, |
||
| 735 | array $pathData, |
||
| 736 | array $languageCodes, |
||
| 737 | $forward, |
||
| 738 | $alwaysAvailable, |
||
| 739 | $destination, |
||
| 740 | $id |
||
| 741 | ) { |
||
| 742 | $handler = $this->getHandler(); |
||
| 743 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_location_custom.php'); |
||
| 744 | |||
| 745 | $urlAlias = $handler->lookup(strtoupper($url)); |
||
| 746 | |||
| 747 | self::assertInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\UrlAlias', $urlAlias); |
||
| 748 | self::assertEquals( |
||
| 749 | new UrlAlias( |
||
| 750 | array( |
||
| 751 | 'id' => $id, |
||
| 752 | 'type' => UrlAlias::LOCATION, |
||
| 753 | 'destination' => $destination, |
||
| 754 | 'languageCodes' => $languageCodes, |
||
| 755 | 'pathData' => $pathData, |
||
| 756 | 'alwaysAvailable' => $alwaysAvailable, |
||
| 757 | 'isHistory' => false, |
||
| 758 | 'isCustom' => true, |
||
| 759 | 'forward' => $forward, |
||
| 760 | ) |
||
| 761 | ), |
||
| 762 | $urlAlias |
||
| 763 | ); |
||
| 764 | } |
||
| 765 | |||
| 766 | public function providerForTestLookupVirtualUrlAlias() |
||
| 767 | { |
||
| 768 | return array( |
||
| 769 | array( |
||
| 770 | 'hello/and', |
||
| 771 | '6-be5d5d37542d75f93a87094459f76678', |
||
| 772 | ), |
||
| 773 | array( |
||
| 774 | 'HELLO/AND', |
||
| 775 | '6-be5d5d37542d75f93a87094459f76678', |
||
| 776 | ), |
||
| 777 | ); |
||
| 778 | } |
||
| 779 | |||
| 780 | /** |
||
| 781 | * Test for the lookup() method. |
||
| 782 | * |
||
| 783 | * Testing that NOP action redirects to site root. |
||
| 784 | * |
||
| 785 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::lookup |
||
| 786 | * @dataProvider providerForTestLookupVirtualUrlAlias |
||
| 787 | * @depends testLookup |
||
| 788 | * @group virtual |
||
| 789 | */ |
||
| 790 | View Code Duplication | public function testLookupVirtualUrlAlias($url, $id) |
|
| 791 | { |
||
| 792 | $handler = $this->getHandler(); |
||
| 793 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_location_custom.php'); |
||
| 794 | |||
| 795 | $urlAlias = $handler->lookup($url); |
||
| 796 | |||
| 797 | $this->assertVirtualUrlAliasValid($urlAlias, $id); |
||
| 798 | } |
||
| 799 | |||
| 800 | public function providerForTestLookupResourceUrlAlias() |
||
| 801 | { |
||
| 802 | return array( |
||
| 803 | array( |
||
| 804 | 'is-alive', |
||
| 805 | array( |
||
| 806 | array( |
||
| 807 | 'always-available' => true, |
||
| 808 | 'translations' => array( |
||
| 809 | 'eng-GB' => 'is-alive', |
||
| 810 | ), |
||
| 811 | ), |
||
| 812 | ), |
||
| 813 | array('eng-GB'), |
||
| 814 | true, |
||
| 815 | true, |
||
| 816 | 'ezinfo/isalive', |
||
| 817 | '0-d003895fa282a14c8ec3eddf23ca4ca2', |
||
| 818 | ), |
||
| 819 | array( |
||
| 820 | 'is-alive/then/search', |
||
| 821 | array( |
||
| 822 | array( |
||
| 823 | 'always-available' => true, |
||
| 824 | 'translations' => array( |
||
| 825 | 'eng-GB' => 'is-alive', |
||
| 826 | ), |
||
| 827 | ), |
||
| 828 | array( |
||
| 829 | 'always-available' => true, |
||
| 830 | 'translations' => array( |
||
| 831 | 'always-available' => 'then', |
||
| 832 | ), |
||
| 833 | ), |
||
| 834 | array( |
||
| 835 | 'always-available' => false, |
||
| 836 | 'translations' => array( |
||
| 837 | 'cro-HR' => 'search', |
||
| 838 | ), |
||
| 839 | ), |
||
| 840 | ), |
||
| 841 | array('cro-HR'), |
||
| 842 | false, |
||
| 843 | false, |
||
| 844 | 'content/search', |
||
| 845 | '3-06a943c59f33a34bb5924aaf72cd2995', |
||
| 846 | ), |
||
| 847 | ); |
||
| 848 | } |
||
| 849 | |||
| 850 | /** |
||
| 851 | * Test for the lookup() method. |
||
| 852 | * |
||
| 853 | * Testing that UrlAlias is found and has expected state. |
||
| 854 | * |
||
| 855 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::lookup |
||
| 856 | * @dataProvider providerForTestLookupResourceUrlAlias |
||
| 857 | * @depends testLookup |
||
| 858 | * @group resource |
||
| 859 | */ |
||
| 860 | View Code Duplication | public function testLookupResourceUrlAlias( |
|
| 861 | $url, |
||
| 862 | $pathData, |
||
| 863 | array $languageCodes, |
||
| 864 | $forward, |
||
| 865 | $alwaysAvailable, |
||
| 866 | $destination, |
||
| 867 | $id |
||
| 868 | ) { |
||
| 869 | $handler = $this->getHandler(); |
||
| 870 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_resource.php'); |
||
| 871 | |||
| 872 | $urlAlias = $handler->lookup($url); |
||
| 873 | |||
| 874 | self::assertInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\UrlAlias', $urlAlias); |
||
| 875 | self::assertEquals( |
||
| 876 | new UrlAlias( |
||
| 877 | array( |
||
| 878 | 'id' => $id, |
||
| 879 | 'type' => UrlAlias::RESOURCE, |
||
| 880 | 'destination' => $destination, |
||
| 881 | 'languageCodes' => $languageCodes, |
||
| 882 | 'pathData' => $pathData, |
||
| 883 | 'alwaysAvailable' => $alwaysAvailable, |
||
| 884 | 'isHistory' => false, |
||
| 885 | 'isCustom' => true, |
||
| 886 | 'forward' => $forward, |
||
| 887 | ) |
||
| 888 | ), |
||
| 889 | $urlAlias |
||
| 890 | ); |
||
| 891 | } |
||
| 892 | |||
| 893 | /** |
||
| 894 | * Test for the lookup() method. |
||
| 895 | * |
||
| 896 | * Testing that UrlAlias is found and has expected state. |
||
| 897 | * |
||
| 898 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::lookup |
||
| 899 | * @dataProvider providerForTestLookupResourceUrlAlias |
||
| 900 | * @depends testLookup |
||
| 901 | * @group resource |
||
| 902 | */ |
||
| 903 | View Code Duplication | public function testLookupResourceUrlAliasCaseInsensitive( |
|
| 904 | $url, |
||
| 905 | $pathData, |
||
| 906 | array $languageCodes, |
||
| 907 | $forward, |
||
| 908 | $alwaysAvailable, |
||
| 909 | $destination, |
||
| 910 | $id |
||
| 911 | ) { |
||
| 912 | $handler = $this->getHandler(); |
||
| 913 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_resource.php'); |
||
| 914 | |||
| 915 | $urlAlias = $handler->lookup(strtoupper($url)); |
||
| 916 | |||
| 917 | self::assertInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\UrlAlias', $urlAlias); |
||
| 918 | self::assertEquals( |
||
| 919 | new UrlAlias( |
||
| 920 | array( |
||
| 921 | 'id' => $id, |
||
| 922 | 'type' => UrlAlias::RESOURCE, |
||
| 923 | 'destination' => $destination, |
||
| 924 | 'languageCodes' => $languageCodes, |
||
| 925 | 'pathData' => $pathData, |
||
| 926 | 'alwaysAvailable' => $alwaysAvailable, |
||
| 927 | 'isHistory' => false, |
||
| 928 | 'isCustom' => true, |
||
| 929 | 'forward' => $forward, |
||
| 930 | ) |
||
| 931 | ), |
||
| 932 | $urlAlias |
||
| 933 | ); |
||
| 934 | } |
||
| 935 | |||
| 936 | /** |
||
| 937 | * Test for the lookup() method with uppercase utf8 characters. |
||
| 938 | * |
||
| 939 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::lookup |
||
| 940 | * @depends testLookup |
||
| 941 | */ |
||
| 942 | public function testLookupUppercaseIri() |
||
| 943 | { |
||
| 944 | $handler = $this->getHandler(); |
||
| 945 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_location_iri.php'); |
||
| 946 | |||
| 947 | $urlAlias = $handler->lookup('΀'); |
||
| 948 | self::assertInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\UrlAlias', $urlAlias); |
||
| 949 | } |
||
| 950 | |||
| 951 | protected function assertVirtualUrlAliasValid(UrlAlias $urlAlias, $id) |
||
| 952 | { |
||
| 953 | self::assertInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\UrlAlias', $urlAlias); |
||
| 954 | self::assertEquals($id, $urlAlias->id); |
||
| 955 | self::assertEquals(UrlAlias::VIRTUAL, $urlAlias->type); |
||
| 956 | /*self::assertEquals( |
||
| 957 | new UrlAlias( |
||
| 958 | array( |
||
| 959 | "id" => $id, |
||
| 960 | "type" => UrlAlias::VIRTUAL, |
||
| 961 | "destination" => null, |
||
| 962 | "languageCodes" => array(), |
||
| 963 | "pathData" => null, |
||
| 964 | "alwaysAvailable" => true, |
||
| 965 | "isHistory" => true, |
||
| 966 | "isCustom" => false, |
||
| 967 | "forward" => false |
||
| 968 | ) |
||
| 969 | ), |
||
| 970 | $urlAlias |
||
| 971 | );*/ |
||
| 972 | } |
||
| 973 | |||
| 974 | /** |
||
| 975 | * Test for the listURLAliasesForLocation() method. |
||
| 976 | * |
||
| 977 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::listURLAliasesForLocation |
||
| 978 | */ |
||
| 979 | public function testListURLAliasesForLocation() |
||
| 980 | { |
||
| 981 | $handler = $this->getHandler(); |
||
| 982 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_location.php'); |
||
| 983 | |||
| 984 | $urlAliases = $handler->listURLAliasesForLocation(315); |
||
| 985 | |||
| 986 | self::assertEquals( |
||
| 987 | array( |
||
| 988 | new UrlAlias( |
||
| 989 | array( |
||
| 990 | 'id' => '2-b8a9f715dbb64fd5c56e7783c6820a61', |
||
| 991 | 'type' => UrlAlias::LOCATION, |
||
| 992 | 'destination' => 315, |
||
| 993 | 'languageCodes' => array('eng-GB'), |
||
| 994 | 'pathData' => array( |
||
| 995 | array( |
||
| 996 | 'always-available' => true, |
||
| 997 | 'translations' => array('cro-HR' => 'jedan'), |
||
| 998 | ), |
||
| 999 | array( |
||
| 1000 | 'always-available' => false, |
||
| 1001 | 'translations' => array( |
||
| 1002 | 'cro-HR' => 'dva', |
||
| 1003 | 'eng-GB' => 'two', |
||
| 1004 | ), |
||
| 1005 | ), |
||
| 1006 | ), |
||
| 1007 | 'alwaysAvailable' => false, |
||
| 1008 | 'isHistory' => false, |
||
| 1009 | 'isCustom' => false, |
||
| 1010 | 'forward' => false, |
||
| 1011 | ) |
||
| 1012 | ), |
||
| 1013 | new UrlAlias( |
||
| 1014 | array( |
||
| 1015 | 'id' => '2-c67ed9a09ab136fae610b6a087d82e21', |
||
| 1016 | 'type' => UrlAlias::LOCATION, |
||
| 1017 | 'destination' => 315, |
||
| 1018 | 'languageCodes' => array('cro-HR'), |
||
| 1019 | 'pathData' => array( |
||
| 1020 | array( |
||
| 1021 | 'always-available' => true, |
||
| 1022 | 'translations' => array('cro-HR' => 'jedan'), |
||
| 1023 | ), |
||
| 1024 | array( |
||
| 1025 | 'always-available' => false, |
||
| 1026 | 'translations' => array( |
||
| 1027 | 'cro-HR' => 'dva', |
||
| 1028 | 'eng-GB' => 'two', |
||
| 1029 | ), |
||
| 1030 | ), |
||
| 1031 | ), |
||
| 1032 | 'alwaysAvailable' => false, |
||
| 1033 | 'isHistory' => false, |
||
| 1034 | 'isCustom' => false, |
||
| 1035 | 'forward' => false, |
||
| 1036 | ) |
||
| 1037 | ), |
||
| 1038 | ), |
||
| 1039 | $urlAliases |
||
| 1040 | ); |
||
| 1041 | } |
||
| 1042 | |||
| 1043 | /** |
||
| 1044 | * Test for the publishUrlAliasForLocation() method. |
||
| 1045 | * |
||
| 1046 | * @todo document |
||
| 1047 | * |
||
| 1048 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::publishUrlAliasForLocation |
||
| 1049 | * @depends testLookupLocationUrlAlias |
||
| 1050 | * @group publish |
||
| 1051 | */ |
||
| 1052 | View Code Duplication | public function testPublishUrlAliasForLocation() |
|
| 1086 | |||
| 1087 | /** |
||
| 1088 | * Test for the publishUrlAliasForLocation() method. |
||
| 1089 | * |
||
| 1090 | * @todo document |
||
| 1091 | * |
||
| 1092 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::publishUrlAliasForLocation |
||
| 1093 | * @depends testPublishUrlAliasForLocation |
||
| 1094 | * @group publish |
||
| 1095 | */ |
||
| 1096 | public function testPublishUrlAliasForLocationRepublish() |
||
| 1097 | { |
||
| 1098 | $handler = $this->getHandler(); |
||
| 1099 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); |
||
| 1100 | |||
| 1101 | $handler->publishUrlAliasForLocation(314, 2, 'simple', 'eng-GB', true); |
||
| 1102 | $publishedUrlAlias = $handler->lookup('simple'); |
||
| 1103 | $handler->publishUrlAliasForLocation(314, 2, 'simple', 'eng-GB', true); |
||
| 1104 | $republishedUrlAlias = $handler->lookup('simple'); |
||
| 1105 | |||
| 1106 | self::assertEquals(4, $this->countRows()); |
||
| 1107 | self::assertEquals( |
||
| 1108 | $publishedUrlAlias, |
||
| 1109 | $republishedUrlAlias |
||
| 1110 | ); |
||
| 1111 | } |
||
| 1112 | |||
| 1113 | /** |
||
| 1114 | * Test for the publishUrlAliasForLocation() method. |
||
| 1115 | * |
||
| 1116 | * @todo document |
||
| 1117 | * |
||
| 1118 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::publishUrlAliasForLocation |
||
| 1119 | * @depends testPublishUrlAliasForLocation |
||
| 1120 | * @group publish |
||
| 1121 | */ |
||
| 1122 | View Code Duplication | 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 |
||
| 1159 | */ |
||
| 1160 | public function providerForTestPublishUrlAliasForLocationComplex() |
||
| 1161 | { |
||
| 1162 | return $this->providerForTestLookupLocationUrlAlias(); |
||
| 1163 | } |
||
| 1164 | |||
| 1165 | /** |
||
| 1166 | * Test for the publishUrlAliasForLocation() method. |
||
| 1167 | * |
||
| 1168 | * @todo document |
||
| 1169 | * |
||
| 1170 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::publishUrlAliasForLocation |
||
| 1171 | * @dataProvider providerForTestPublishUrlAliasForLocationComplex |
||
| 1172 | * @depends testPublishUrlAliasForLocation |
||
| 1173 | * @group publish |
||
| 1174 | */ |
||
| 1175 | public function testPublishUrlAliasForLocationComplex( |
||
| 1176 | $url, |
||
| 1177 | $pathData, |
||
| 1178 | array $languageCodes, |
||
| 1179 | $alwaysAvailable, |
||
| 1180 | $locationId, |
||
| 1181 | $id |
||
| 1182 | ) { |
||
| 1183 | $handler = $this->getHandler(); |
||
| 1184 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); |
||
| 1185 | |||
| 1186 | $handler->publishUrlAliasForLocation(314, 2, 'jedan', 'cro-HR', true); |
||
| 1187 | $handler->publishUrlAliasForLocation(315, 314, 'dva', 'cro-HR', false); |
||
| 1188 | $handler->publishUrlAliasForLocation(315, 314, 'two', 'eng-GB', false); |
||
| 1189 | $handler->publishUrlAliasForLocation(316, 315, 'tri', 'cro-HR', false); |
||
| 1190 | $handler->publishUrlAliasForLocation(316, 315, 'three', 'eng-GB', false); |
||
| 1191 | $handler->publishUrlAliasForLocation(316, 315, 'drei', 'ger-DE', false); |
||
| 1192 | |||
| 1193 | $urlAlias = $handler->lookup($url); |
||
| 1194 | |||
| 1195 | self::assertInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\UrlAlias', $urlAlias); |
||
| 1196 | self::assertEquals( |
||
| 1197 | new UrlAlias( |
||
| 1198 | array( |
||
| 1199 | 'id' => $id, |
||
| 1200 | 'type' => UrlAlias::LOCATION, |
||
| 1201 | 'destination' => $locationId, |
||
| 1202 | 'languageCodes' => $languageCodes, |
||
| 1203 | 'pathData' => $pathData, |
||
| 1204 | 'alwaysAvailable' => $alwaysAvailable, |
||
| 1205 | 'isHistory' => false, |
||
| 1206 | 'isCustom' => false, |
||
| 1207 | 'forward' => false, |
||
| 1208 | ) |
||
| 1209 | ), |
||
| 1210 | $urlAlias |
||
| 1211 | ); |
||
| 1212 | } |
||
| 1213 | |||
| 1214 | /** |
||
| 1215 | * Test for the publishUrlAliasForLocation() method. |
||
| 1216 | * |
||
| 1217 | * @todo document |
||
| 1218 | * |
||
| 1219 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::publishUrlAliasForLocation |
||
| 1220 | * @depends testPublishUrlAliasForLocation |
||
| 1221 | * @group publish |
||
| 1222 | */ |
||
| 1223 | public function testPublishUrlAliasForLocationSameAliasForMultipleLanguages() |
||
| 1224 | { |
||
| 1225 | $handler = $this->getHandler(); |
||
| 1226 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); |
||
| 1227 | |||
| 1228 | $handler->publishUrlAliasForLocation(314, 2, 'jedan', 'cro-HR', false); |
||
| 1229 | $urlAlias1 = $handler->lookup('jedan'); |
||
| 1230 | $handler->publishUrlAliasForLocation(314, 2, 'jedan', 'eng-GB', false); |
||
| 1231 | $urlAlias2 = $handler->lookup('jedan'); |
||
| 1232 | |||
| 1233 | self::assertEquals(4, $this->countRows()); |
||
| 1234 | |||
| 1235 | foreach ($urlAlias2 as $propertyName => $propertyValue) { |
||
|
|
|||
| 1236 | if ($propertyName === 'languageCodes') { |
||
| 1237 | self::assertEquals( |
||
| 1238 | array('cro-HR', 'eng-GB'), |
||
| 1239 | $urlAlias2->languageCodes |
||
| 1240 | ); |
||
| 1241 | } elseif ($propertyName === 'pathData') { |
||
| 1242 | self::assertEquals( |
||
| 1243 | array( |
||
| 1244 | array( |
||
| 1245 | 'always-available' => false, |
||
| 1246 | 'translations' => array( |
||
| 1247 | 'cro-HR' => 'jedan', |
||
| 1248 | 'eng-GB' => 'jedan', |
||
| 1249 | ), |
||
| 1250 | ), |
||
| 1251 | ), |
||
| 1252 | $urlAlias2->pathData |
||
| 1253 | ); |
||
| 1254 | } else { |
||
| 1255 | self::assertEquals( |
||
| 1256 | $urlAlias1->$propertyName, |
||
| 1257 | $urlAlias2->$propertyName |
||
| 1258 | ); |
||
| 1259 | } |
||
| 1260 | } |
||
| 1261 | } |
||
| 1262 | |||
| 1263 | /** |
||
| 1264 | * Test for the publishUrlAliasForLocation() method. |
||
| 1265 | * |
||
| 1266 | * @todo document |
||
| 1267 | * |
||
| 1268 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::publishUrlAliasForLocation |
||
| 1269 | * @depends testPublishUrlAliasForLocation |
||
| 1270 | * @group publish |
||
| 1271 | */ |
||
| 1272 | public function testPublishUrlAliasForLocationDowngradesOldEntryToHistory() |
||
| 1273 | { |
||
| 1274 | $handler = $this->getHandler(); |
||
| 1275 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); |
||
| 1276 | |||
| 1277 | $handler->publishUrlAliasForLocation(314, 2, 'jedan', 'cro-HR', false); |
||
| 1278 | $handler->publishUrlAliasForLocation(314, 2, 'dva', 'cro-HR', true); |
||
| 1279 | |||
| 1280 | self::assertEquals(5, $this->countRows()); |
||
| 1281 | |||
| 1282 | $newUrlAlias = $handler->lookup('dva'); |
||
| 1283 | |||
| 1284 | self::assertEquals( |
||
| 1285 | new UrlAlias( |
||
| 1286 | array( |
||
| 1287 | 'id' => '0-c67ed9a09ab136fae610b6a087d82e21', |
||
| 1288 | 'type' => 0, |
||
| 1289 | 'destination' => 314, |
||
| 1290 | 'languageCodes' => array('cro-HR'), |
||
| 1291 | 'pathData' => array( |
||
| 1292 | array( |
||
| 1293 | 'always-available' => true, |
||
| 1294 | 'translations' => array( |
||
| 1295 | 'cro-HR' => 'dva', |
||
| 1296 | ), |
||
| 1297 | ), |
||
| 1298 | ), |
||
| 1299 | 'alwaysAvailable' => true, |
||
| 1300 | 'isHistory' => false, |
||
| 1301 | 'isCustom' => false, |
||
| 1302 | 'forward' => false, |
||
| 1303 | ) |
||
| 1304 | ), |
||
| 1305 | $newUrlAlias |
||
| 1306 | ); |
||
| 1307 | |||
| 1308 | $historyUrlAlias = $handler->lookup('jedan'); |
||
| 1309 | |||
| 1310 | self::assertEquals( |
||
| 1311 | new UrlAlias( |
||
| 1312 | array( |
||
| 1313 | 'id' => '0-6896260129051a949051c3847c34466f', |
||
| 1314 | 'type' => 0, |
||
| 1315 | 'destination' => 314, |
||
| 1316 | 'languageCodes' => array('cro-HR'), |
||
| 1317 | 'pathData' => array( |
||
| 1318 | array( |
||
| 1319 | 'always-available' => false, |
||
| 1320 | 'translations' => array( |
||
| 1321 | 'cro-HR' => 'jedan', |
||
| 1322 | ), |
||
| 1323 | ), |
||
| 1324 | ), |
||
| 1325 | 'alwaysAvailable' => false, |
||
| 1326 | 'isHistory' => true, |
||
| 1327 | 'isCustom' => false, |
||
| 1328 | 'forward' => false, |
||
| 1329 | ) |
||
| 1330 | ), |
||
| 1331 | $historyUrlAlias |
||
| 1332 | ); |
||
| 1333 | } |
||
| 1334 | |||
| 1335 | /** |
||
| 1336 | * Test for the publishUrlAliasForLocation() method. |
||
| 1337 | * |
||
| 1338 | * @todo document |
||
| 1339 | * |
||
| 1340 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::publishUrlAliasForLocation |
||
| 1341 | * @depends testPublishUrlAliasForLocation |
||
| 1342 | * @depends testPublishUrlAliasForLocationSameAliasForMultipleLanguages |
||
| 1343 | * @group publish |
||
| 1344 | * @group downgrade |
||
| 1345 | */ |
||
| 1346 | public function testPublishUrlAliasForLocationDowngradesOldEntryRemovesLanguage() |
||
| 1347 | { |
||
| 1348 | $handler = $this->getHandler(); |
||
| 1349 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); |
||
| 1350 | |||
| 1351 | $handler->publishUrlAliasForLocation(314, 2, 'jedan', 'cro-HR'); |
||
| 1352 | $handler->publishUrlAliasForLocation(314, 2, 'jedan', 'eng-GB'); |
||
| 1353 | $handler->publishUrlAliasForLocation(314, 2, 'dva', 'eng-GB'); |
||
| 1354 | |||
| 1355 | self::assertEquals(5, $this->countRows()); |
||
| 1356 | |||
| 1357 | $urlAlias = $handler->lookup('dva'); |
||
| 1358 | self::assertEquals( |
||
| 1359 | new UrlAlias( |
||
| 1360 | array( |
||
| 1361 | 'id' => '0-c67ed9a09ab136fae610b6a087d82e21', |
||
| 1362 | 'type' => UrlAlias::LOCATION, |
||
| 1363 | 'destination' => 314, |
||
| 1364 | 'languageCodes' => array('eng-GB'), |
||
| 1365 | 'pathData' => array( |
||
| 1366 | array( |
||
| 1367 | 'always-available' => false, |
||
| 1368 | 'translations' => array( |
||
| 1369 | 'cro-HR' => 'jedan', |
||
| 1370 | 'eng-GB' => 'dva', |
||
| 1371 | ), |
||
| 1372 | ), |
||
| 1373 | ), |
||
| 1374 | 'alwaysAvailable' => false, |
||
| 1375 | 'isHistory' => false, |
||
| 1376 | 'isCustom' => false, |
||
| 1377 | 'forward' => false, |
||
| 1378 | ) |
||
| 1379 | ), |
||
| 1380 | $urlAlias |
||
| 1381 | ); |
||
| 1382 | |||
| 1383 | $downgradedUrlAlias = $handler->lookup('jedan'); |
||
| 1384 | self::assertEquals( |
||
| 1385 | new UrlAlias( |
||
| 1386 | array( |
||
| 1387 | 'id' => '0-6896260129051a949051c3847c34466f', |
||
| 1388 | 'type' => UrlAlias::LOCATION, |
||
| 1389 | 'destination' => 314, |
||
| 1390 | 'languageCodes' => array('cro-HR'), |
||
| 1391 | 'pathData' => array( |
||
| 1392 | array( |
||
| 1393 | 'always-available' => false, |
||
| 1394 | 'translations' => array( |
||
| 1395 | 'cro-HR' => 'jedan', |
||
| 1396 | 'eng-GB' => 'dva', |
||
| 1397 | ), |
||
| 1398 | ), |
||
| 1399 | ), |
||
| 1400 | 'alwaysAvailable' => false, |
||
| 1401 | 'isHistory' => false, |
||
| 1402 | 'isCustom' => false, |
||
| 1403 | 'forward' => false, |
||
| 1404 | ) |
||
| 1405 | ), |
||
| 1406 | $downgradedUrlAlias |
||
| 1407 | ); |
||
| 1408 | } |
||
| 1409 | |||
| 1410 | /** |
||
| 1411 | * Test for the publishUrlAliasForLocation() method. |
||
| 1412 | * |
||
| 1413 | * @todo document |
||
| 1414 | * |
||
| 1415 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::publishUrlAliasForLocation |
||
| 1416 | * @depends testPublishUrlAliasForLocation |
||
| 1417 | * @depends testPublishUrlAliasForLocationDowngradesOldEntryToHistory |
||
| 1418 | * @group publish |
||
| 1419 | */ |
||
| 1420 | public function testPublishUrlAliasForLocationReusesHistory() |
||
| 1421 | { |
||
| 1422 | $handler = $this->getHandler(); |
||
| 1423 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); |
||
| 1424 | |||
| 1425 | $handler->publishUrlAliasForLocation(314, 2, 'jedan', 'cro-HR'); |
||
| 1426 | $urlAlias = $handler->lookup('jedan'); |
||
| 1427 | $handler->publishUrlAliasForLocation(314, 2, 'dva', 'cro-HR'); |
||
| 1428 | $countBeforeReusing = $this->countRows(); |
||
| 1429 | $handler->publishUrlAliasForLocation(314, 2, 'jedan', 'cro-HR'); |
||
| 1430 | $urlAliasReusesHistory = $handler->lookup('jedan'); |
||
| 1431 | |||
| 1432 | self::assertEquals( |
||
| 1433 | $countBeforeReusing, |
||
| 1434 | $this->countRows() |
||
| 1435 | ); |
||
| 1436 | |||
| 1437 | self::assertEquals( |
||
| 1438 | $urlAlias, |
||
| 1439 | $urlAliasReusesHistory |
||
| 1440 | ); |
||
| 1441 | } |
||
| 1442 | |||
| 1443 | /** |
||
| 1444 | * Test for the publishUrlAliasForLocation() method. |
||
| 1445 | * |
||
| 1446 | * @todo document |
||
| 1447 | * |
||
| 1448 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::publishUrlAliasForLocation |
||
| 1449 | * @depends testPublishUrlAliasForLocation |
||
| 1450 | * @depends testPublishUrlAliasForLocationDowngradesOldEntryToHistory |
||
| 1451 | * @group publish |
||
| 1452 | */ |
||
| 1453 | public function testPublishUrlAliasForLocationReusesHistoryOfDifferentLanguage() |
||
| 1454 | { |
||
| 1455 | $handler = $this->getHandler(); |
||
| 1456 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); |
||
| 1457 | |||
| 1458 | $handler->publishUrlAliasForLocation(314, 2, 'jedan', 'cro-HR'); |
||
| 1459 | $handler->publishUrlAliasForLocation(314, 2, 'one-history', 'eng-GB'); |
||
| 1460 | $handler->publishUrlAliasForLocation(314, 2, 'one-new', 'eng-GB'); |
||
| 1461 | $countBeforeReusing = $this->countRows(); |
||
| 1462 | $handler->publishUrlAliasForLocation(314, 2, 'one-history', 'cro-HR'); |
||
| 1463 | $urlAliasReusesHistory = $handler->lookup('one-history'); |
||
| 1464 | |||
| 1465 | self::assertEquals( |
||
| 1466 | $countBeforeReusing, |
||
| 1467 | $this->countRows() |
||
| 1468 | ); |
||
| 1469 | |||
| 1470 | self::assertEquals( |
||
| 1471 | new UrlAlias( |
||
| 1472 | array( |
||
| 1473 | 'id' => '0-' . md5('one-history'), |
||
| 1474 | 'type' => UrlAlias::LOCATION, |
||
| 1475 | 'destination' => 314, |
||
| 1476 | 'languageCodes' => array('cro-HR'), |
||
| 1477 | 'pathData' => array( |
||
| 1478 | array( |
||
| 1479 | 'always-available' => false, |
||
| 1480 | 'translations' => array( |
||
| 1481 | 'cro-HR' => 'one-history', |
||
| 1482 | 'eng-GB' => 'one-new', |
||
| 1483 | ), |
||
| 1484 | ), |
||
| 1485 | ), |
||
| 1486 | 'alwaysAvailable' => false, |
||
| 1487 | 'isHistory' => false, |
||
| 1488 | 'isCustom' => false, |
||
| 1489 | 'forward' => false, |
||
| 1490 | ) |
||
| 1491 | ), |
||
| 1492 | $urlAliasReusesHistory |
||
| 1493 | ); |
||
| 1494 | } |
||
| 1495 | |||
| 1496 | /** |
||
| 1497 | * Test for the publishUrlAliasForLocation() method. |
||
| 1498 | * |
||
| 1499 | * @todo document |
||
| 1500 | * |
||
| 1501 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::publishUrlAliasForLocation |
||
| 1502 | * @depends testPublishUrlAliasForLocation |
||
| 1503 | * @group publish |
||
| 1504 | */ |
||
| 1505 | View Code Duplication | public function testPublishUrlAliasForLocationReusesCustomAlias() |
|
| 1506 | { |
||
| 1507 | $handler = $this->getHandler(); |
||
| 1508 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php'); |
||
| 1509 | |||
| 1510 | $countBeforeReusing = $this->countRows(); |
||
| 1511 | $handler->publishUrlAliasForLocation(314, 2, 'custom-hello', 'eng-GB', false); |
||
| 1512 | $urlAlias = $handler->lookup('custom-hello'); |
||
| 1513 | |||
| 1514 | self::assertEquals( |
||
| 1515 | $countBeforeReusing, |
||
| 1516 | $this->countRows() |
||
| 1517 | ); |
||
| 1518 | self::assertFalse($urlAlias->isCustom); |
||
| 1519 | } |
||
| 1520 | |||
| 1521 | /** |
||
| 1522 | * Test for the publishUrlAliasForLocation() method. |
||
| 1523 | * |
||
| 1524 | * @todo document |
||
| 1525 | * |
||
| 1526 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::publishUrlAliasForLocation |
||
| 1527 | * @depends testPublishUrlAliasForLocation |
||
| 1528 | */ |
||
| 1529 | public function testPublishUrlAliasForLocationReusingNopElement() |
||
| 1530 | { |
||
| 1531 | $handler = $this->getHandler(); |
||
| 1532 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php'); |
||
| 1533 | |||
| 1534 | $countBeforeReusing = $this->countRows(); |
||
| 1535 | $virtualUrlAlias = $handler->lookup('nop-element/search'); |
||
| 1536 | $handler->publishUrlAliasForLocation(315, 2, 'nop-element', 'eng-GB', false); |
||
| 1537 | $publishedLocationUrlAlias = $handler->lookup('nop-element'); |
||
| 1538 | |||
| 1539 | self::assertEquals( |
||
| 1540 | $countBeforeReusing, |
||
| 1541 | $this->countRows() |
||
| 1542 | ); |
||
| 1543 | |||
| 1544 | self::assertInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\UrlAlias', $publishedLocationUrlAlias); |
||
| 1545 | self::assertEquals( |
||
| 1546 | new UrlAlias( |
||
| 1547 | array( |
||
| 1548 | 'id' => '0-de55c2fff721217cc4cb67b58dc35f85', |
||
| 1549 | 'type' => UrlAlias::LOCATION, |
||
| 1550 | 'destination' => 315, |
||
| 1551 | 'languageCodes' => array('eng-GB'), |
||
| 1552 | 'pathData' => array( |
||
| 1553 | array( |
||
| 1554 | 'always-available' => false, |
||
| 1555 | 'translations' => array('eng-GB' => 'nop-element'), |
||
| 1556 | ), |
||
| 1557 | ), |
||
| 1558 | 'alwaysAvailable' => false, |
||
| 1559 | 'isHistory' => false, |
||
| 1560 | 'isCustom' => false, |
||
| 1561 | 'forward' => false, |
||
| 1562 | ) |
||
| 1563 | ), |
||
| 1564 | $publishedLocationUrlAlias |
||
| 1565 | ); |
||
| 1566 | |||
| 1567 | $virtualUrlAliasReloaded = $handler->lookup('nop-element/search'); |
||
| 1568 | View Code Duplication | foreach ($virtualUrlAliasReloaded as $propertyName => $propertyValue) { |
|
| 1569 | if ($propertyName === 'pathData') { |
||
| 1570 | self::assertEquals( |
||
| 1571 | array( |
||
| 1572 | array( |
||
| 1573 | 'always-available' => false, |
||
| 1574 | 'translations' => array('eng-GB' => 'nop-element'), |
||
| 1575 | ), |
||
| 1576 | array( |
||
| 1577 | 'always-available' => false, |
||
| 1578 | 'translations' => array('eng-GB' => 'search'), |
||
| 1579 | ), |
||
| 1580 | ), |
||
| 1581 | $virtualUrlAliasReloaded->pathData |
||
| 1582 | ); |
||
| 1583 | } else { |
||
| 1584 | self::assertEquals( |
||
| 1585 | $virtualUrlAlias->$propertyName, |
||
| 1586 | $virtualUrlAliasReloaded->$propertyName |
||
| 1587 | ); |
||
| 1588 | } |
||
| 1589 | } |
||
| 1590 | } |
||
| 1591 | |||
| 1592 | /** |
||
| 1593 | * Test for the publishUrlAliasForLocation() method. |
||
| 1594 | * |
||
| 1595 | * @todo document |
||
| 1596 | * |
||
| 1597 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::publishUrlAliasForLocation |
||
| 1598 | * @depends testPublishUrlAliasForLocation |
||
| 1599 | * @depends testPublishUrlAliasForLocationReusingNopElement |
||
| 1600 | */ |
||
| 1601 | public function testPublishUrlAliasForLocationReusingNopElementChangesCustomPath() |
||
| 1602 | { |
||
| 1603 | $handler = $this->getHandler(); |
||
| 1604 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php'); |
||
| 1605 | |||
| 1606 | $countBeforeReusing = $this->countRows(); |
||
| 1607 | $virtualUrlAlias = $handler->lookup('nop-element/search'); |
||
| 1608 | $handler->publishUrlAliasForLocation(315, 2, 'nop-element', 'eng-GB', false); |
||
| 1609 | $handler->publishUrlAliasForLocation(315, 2, 'nop-element-renamed', 'eng-GB', false); |
||
| 1610 | $virtualUrlAliasChanged = $handler->lookup('nop-element-renamed/search'); |
||
| 1611 | |||
| 1612 | self::assertEquals( |
||
| 1613 | $countBeforeReusing + 1, |
||
| 1614 | $this->countRows() |
||
| 1615 | ); |
||
| 1616 | |||
| 1617 | View Code Duplication | foreach ($virtualUrlAliasChanged as $propertyName => $propertyValue) { |
|
| 1618 | if ($propertyName === 'pathData') { |
||
| 1619 | self::assertEquals( |
||
| 1620 | array( |
||
| 1621 | array( |
||
| 1622 | 'always-available' => false, |
||
| 1623 | 'translations' => array('eng-GB' => 'nop-element-renamed'), |
||
| 1624 | ), |
||
| 1625 | array( |
||
| 1626 | 'always-available' => false, |
||
| 1627 | 'translations' => array('eng-GB' => 'search'), |
||
| 1628 | ), |
||
| 1629 | ), |
||
| 1630 | $virtualUrlAliasChanged->pathData |
||
| 1631 | ); |
||
| 1632 | } else { |
||
| 1633 | self::assertEquals( |
||
| 1634 | $virtualUrlAlias->$propertyName, |
||
| 1635 | $virtualUrlAliasChanged->$propertyName |
||
| 1636 | ); |
||
| 1637 | } |
||
| 1638 | } |
||
| 1639 | } |
||
| 1640 | |||
| 1641 | /** |
||
| 1642 | * Test for the publishUrlAliasForLocation() method. |
||
| 1643 | * |
||
| 1644 | * @todo document |
||
| 1645 | * |
||
| 1646 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::publishUrlAliasForLocation |
||
| 1647 | * @depends testPublishUrlAliasForLocation |
||
| 1648 | * @depends testPublishUrlAliasForLocationReusingNopElementChangesCustomPath |
||
| 1649 | */ |
||
| 1650 | public function testPublishUrlAliasForLocationReusingNopElementChangesCustomPathAndCreatesHistory() |
||
| 1651 | { |
||
| 1652 | $handler = $this->getHandler(); |
||
| 1653 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php'); |
||
| 1654 | |||
| 1655 | $handler->publishUrlAliasForLocation(315, 2, 'nop-element', 'eng-GB', false); |
||
| 1656 | $handler->publishUrlAliasForLocation(315, 2, 'nop-element-renamed', 'eng-GB', false); |
||
| 1657 | |||
| 1658 | $customUrlAliasChanged = $handler->lookup('nop-element-renamed/search'); |
||
| 1659 | $customUrlAliasHistory = $handler->lookup('nop-element/search'); |
||
| 1660 | |||
| 1661 | self::assertTrue($customUrlAliasHistory->isHistory); |
||
| 1662 | $customUrlAliasHistory->isHistory = false; |
||
| 1663 | self::assertEquals( |
||
| 1664 | $customUrlAliasChanged, |
||
| 1665 | $customUrlAliasHistory |
||
| 1666 | ); |
||
| 1667 | } |
||
| 1668 | |||
| 1669 | /** |
||
| 1670 | * Test for the publishUrlAliasForLocation() method. |
||
| 1671 | * |
||
| 1672 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::publishUrlAliasForLocation |
||
| 1673 | */ |
||
| 1674 | public function testPublishUrlAliasForLocationUpdatesLocationPathIdentificationString() |
||
| 1675 | { |
||
| 1676 | $handler = $this->getHandler(); |
||
| 1677 | $locationGateway = $this->getLocationGateway(); |
||
| 1678 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); |
||
| 1679 | |||
| 1680 | // Publishes the alias indicating that language is main, triggering updating of path_identification_string |
||
| 1681 | $handler->publishUrlAliasForLocation(316, 315, 'TEST TEST TEST', 'eng-GB', false, true); |
||
| 1682 | |||
| 1683 | $locationData = $locationGateway->getBasicNodeData(316); |
||
| 1684 | |||
| 1685 | self::assertEquals('path314/path315/test_test_test', $locationData['path_identification_string']); |
||
| 1686 | } |
||
| 1687 | |||
| 1688 | /** |
||
| 1689 | * Test for the createCustomUrlAlias() method. |
||
| 1690 | * |
||
| 1691 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::createCustomUrlAlias |
||
| 1692 | * @group create |
||
| 1693 | * @group custom |
||
| 1694 | */ |
||
| 1695 | View Code Duplication | public function testCreateCustomUrlAliasBehaviour() |
|
| 1696 | { |
||
| 1697 | $handlerMock = $this->getPartlyMockedHandler(array('createUrlAlias')); |
||
| 1698 | |||
| 1699 | $handlerMock->expects( |
||
| 1700 | $this->once() |
||
| 1701 | )->method( |
||
| 1702 | 'createUrlAlias' |
||
| 1703 | )->with( |
||
| 1704 | $this->equalTo('eznode:1'), |
||
| 1705 | $this->equalTo('path'), |
||
| 1706 | $this->equalTo(false), |
||
| 1707 | $this->equalTo(null), |
||
| 1708 | $this->equalTo(false) |
||
| 1709 | )->will( |
||
| 1710 | $this->returnValue( |
||
| 1711 | new UrlAlias() |
||
| 1712 | ) |
||
| 1713 | ); |
||
| 1714 | |||
| 1715 | $this->assertInstanceOf( |
||
| 1716 | 'eZ\\Publish\\SPI\\Persistence\\Content\\UrlAlias', |
||
| 1717 | $handlerMock->createCustomUrlAlias(1, 'path') |
||
| 1718 | ); |
||
| 1719 | } |
||
| 1720 | |||
| 1721 | /** |
||
| 1722 | * Test for the createGlobalUrlAlias() method. |
||
| 1723 | * |
||
| 1724 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::createGlobalUrlAlias |
||
| 1725 | * @group create |
||
| 1726 | * @group global |
||
| 1727 | */ |
||
| 1728 | View Code Duplication | public function testCreateGlobalUrlAliasBehaviour() |
|
| 1729 | { |
||
| 1730 | $handlerMock = $this->getPartlyMockedHandler(array('createUrlAlias')); |
||
| 1731 | |||
| 1732 | $handlerMock->expects( |
||
| 1733 | $this->once() |
||
| 1734 | )->method( |
||
| 1735 | 'createUrlAlias' |
||
| 1736 | )->with( |
||
| 1737 | $this->equalTo('module/module'), |
||
| 1738 | $this->equalTo('path'), |
||
| 1739 | $this->equalTo(false), |
||
| 1740 | $this->equalTo(null), |
||
| 1741 | $this->equalTo(false) |
||
| 1742 | )->will( |
||
| 1743 | $this->returnValue( |
||
| 1744 | new UrlAlias() |
||
| 1745 | ) |
||
| 1746 | ); |
||
| 1747 | |||
| 1748 | $this->assertInstanceOf( |
||
| 1749 | 'eZ\\Publish\\SPI\\Persistence\\Content\\UrlAlias', |
||
| 1750 | $handlerMock->createGlobalUrlAlias('module/module', 'path') |
||
| 1751 | ); |
||
| 1752 | } |
||
| 1753 | |||
| 1754 | /** |
||
| 1755 | * Test for the createUrlAlias() method. |
||
| 1756 | * |
||
| 1757 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::createUrlAlias |
||
| 1758 | * @group create |
||
| 1759 | * @group custom |
||
| 1760 | */ |
||
| 1761 | public function testCreateCustomUrlAlias() |
||
| 1762 | { |
||
| 1763 | $handler = $this->getHandler(); |
||
| 1764 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); |
||
| 1765 | |||
| 1766 | $path = 'custom-location-alias'; |
||
| 1767 | $customUrlAlias = $handler->createCustomUrlAlias( |
||
| 1768 | 314, |
||
| 1769 | $path, |
||
| 1770 | false, |
||
| 1771 | 'cro-HR', |
||
| 1772 | false |
||
| 1773 | ); |
||
| 1774 | |||
| 1775 | self::assertEquals(4, $this->countRows()); |
||
| 1776 | self::assertEquals( |
||
| 1777 | new UrlAlias( |
||
| 1778 | array( |
||
| 1779 | 'id' => '0-' . md5($path), |
||
| 1780 | 'type' => UrlAlias::LOCATION, |
||
| 1781 | 'destination' => 314, |
||
| 1782 | 'pathData' => array( |
||
| 1783 | array( |
||
| 1784 | 'always-available' => false, |
||
| 1785 | 'translations' => array( |
||
| 1786 | 'cro-HR' => 'custom-location-alias', |
||
| 1787 | ), |
||
| 1788 | ), |
||
| 1789 | ), |
||
| 1790 | 'languageCodes' => array('cro-HR'), |
||
| 1791 | 'alwaysAvailable' => false, |
||
| 1792 | 'isHistory' => false, |
||
| 1793 | 'isCustom' => true, |
||
| 1794 | 'forward' => false, |
||
| 1795 | ) |
||
| 1796 | ), |
||
| 1797 | $customUrlAlias |
||
| 1798 | ); |
||
| 1799 | } |
||
| 1800 | |||
| 1801 | /** |
||
| 1802 | * Test for the createUrlAlias() method. |
||
| 1803 | * |
||
| 1804 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::createUrlAlias |
||
| 1805 | * @group create |
||
| 1806 | * @group custom |
||
| 1807 | */ |
||
| 1808 | public function testCreateCustomUrlAliasWithNonameParts() |
||
| 1872 | |||
| 1873 | /** |
||
| 1874 | * Test for the createUrlAlias() method. |
||
| 1875 | * |
||
| 1876 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::createUrlAlias |
||
| 1877 | * @group create |
||
| 1878 | * @group custom |
||
| 1879 | * |
||
| 1880 | * @todo pathData |
||
| 1881 | */ |
||
| 1882 | public function testCreatedCustomUrlAliasIsLoadable() |
||
| 1883 | { |
||
| 1884 | $handler = $this->getHandler(); |
||
| 1885 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); |
||
| 1886 | |||
| 1887 | $path = 'custom-location-alias'; |
||
| 1888 | $customUrlAlias = $handler->createCustomUrlAlias( |
||
| 1889 | 314, |
||
| 1890 | $path, |
||
| 1891 | false, |
||
| 1892 | 'cro-HR', |
||
| 1893 | false |
||
| 1894 | ); |
||
| 1895 | $loadedCustomUrlAlias = $handler->lookup($path); |
||
| 1896 | |||
| 1897 | self::assertEquals(4, $this->countRows()); |
||
| 1898 | |||
| 1899 | foreach ($loadedCustomUrlAlias as $propertyName => $propertyValue) { |
||
| 1900 | if ($propertyName === 'pathData') { |
||
| 1901 | self::assertEquals( |
||
| 1902 | array( |
||
| 1903 | array( |
||
| 1904 | 'always-available' => false, |
||
| 1905 | 'translations' => array('cro-HR' => $path), |
||
| 1906 | ), |
||
| 1907 | ), |
||
| 1908 | $loadedCustomUrlAlias->$propertyName |
||
| 1909 | ); |
||
| 1910 | } else { |
||
| 1911 | self::assertEquals( |
||
| 1912 | $customUrlAlias->$propertyName, |
||
| 1913 | $loadedCustomUrlAlias->$propertyName |
||
| 1914 | ); |
||
| 1915 | } |
||
| 1916 | } |
||
| 1917 | } |
||
| 1918 | |||
| 1919 | /** |
||
| 1920 | * Test for the createUrlAlias() method. |
||
| 1921 | * |
||
| 1922 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::createUrlAlias |
||
| 1923 | * @group create |
||
| 1924 | * @group custom |
||
| 1925 | */ |
||
| 1926 | public function testCreateCustomUrlAliasWithNopElement() |
||
| 1973 | |||
| 1974 | /** |
||
| 1975 | * Test for the createUrlAlias() method. |
||
| 1976 | * |
||
| 1977 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::createUrlAlias |
||
| 1978 | * @depends testCreateCustomUrlAliasWithNopElement |
||
| 1979 | * @group create |
||
| 1980 | * @group custom |
||
| 1981 | */ |
||
| 1982 | public function testCreateUrlAliasWithNopElementCreatesValidNopElement(Handler $handler) |
||
| 1983 | { |
||
| 1984 | $url = 'ribar'; |
||
| 1985 | $urlAlias = $handler->lookup($url); |
||
| 1986 | |||
| 1987 | $this->assertVirtualUrlAliasValid( |
||
| 1988 | $urlAlias, |
||
| 1989 | '0-' . md5($url) |
||
| 1990 | ); |
||
| 1991 | } |
||
| 1992 | |||
| 1993 | /** |
||
| 1994 | * Test for the createUrlAlias() method. |
||
| 1995 | * |
||
| 1996 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::createUrlAlias |
||
| 1997 | * @group create |
||
| 1998 | * @group custom |
||
| 1999 | */ |
||
| 2000 | View Code Duplication | public function testCreateCustomUrlAliasReusesHistory() |
|
| 2001 | { |
||
| 2002 | $handler = $this->getHandler(); |
||
| 2003 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php'); |
||
| 2004 | |||
| 2005 | $countBeforeReusing = $this->countRows(); |
||
| 2006 | $handler->createCustomUrlAlias( |
||
| 2007 | 314, |
||
| 2008 | 'history-hello', |
||
| 2009 | true, |
||
| 2010 | 'eng-GB', |
||
| 2011 | true |
||
| 2040 | |||
| 2041 | /** |
||
| 2042 | * Test for the createUrlAlias() method. |
||
| 2043 | * |
||
| 2044 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::createUrlAlias |
||
| 2045 | * @group create |
||
| 2046 | * @group custom |
||
| 2047 | */ |
||
| 2048 | View Code Duplication | public function testCreateCustomUrlAliasReusesHistoryOfDifferentLanguage() |
|
| 2088 | |||
| 2089 | /** |
||
| 2090 | * Test for the createUrlAlias() method. |
||
| 2091 | * |
||
| 2092 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::createUrlAlias |
||
| 2093 | * @group create |
||
| 2094 | * @group custom |
||
| 2095 | */ |
||
| 2096 | public function testCreateCustomUrlAliasReusesNopElement() |
||
| 2142 | |||
| 2143 | /** |
||
| 2144 | * Test for the createUrlAlias() method. |
||
| 2145 | * |
||
| 2146 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::createUrlAlias |
||
| 2147 | * @group create |
||
| 2148 | * @group custom |
||
| 2149 | */ |
||
| 2150 | View Code Duplication | public function testCreateCustomUrlAliasReusesLocationElement() |
|
| 2176 | |||
| 2177 | /** |
||
| 2178 | * Test for the listGlobalURLAliases() method. |
||
| 2179 | * |
||
| 2180 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::listGlobalURLAliases |
||
| 2181 | * @depends testLookupResourceUrlAlias |
||
| 2182 | */ |
||
| 2183 | public function testListGlobalURLAliases() |
||
| 2199 | |||
| 2200 | /** |
||
| 2201 | * Test for the listGlobalURLAliases() method. |
||
| 2202 | * |
||
| 2203 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::listGlobalURLAliases |
||
| 2204 | * @depends testLookupResourceUrlAlias |
||
| 2205 | */ |
||
| 2206 | View Code Duplication | public function testListGlobalURLAliasesWithLanguageCode() |
|
| 2221 | |||
| 2222 | /** |
||
| 2223 | * Test for the listGlobalURLAliases() method. |
||
| 2224 | * |
||
| 2225 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::listGlobalURLAliases |
||
| 2226 | * @depends testLookupResourceUrlAlias |
||
| 2227 | */ |
||
| 2228 | public function testListGlobalURLAliasesWithOffset() |
||
| 2242 | |||
| 2243 | /** |
||
| 2244 | * Test for the listGlobalURLAliases() method. |
||
| 2245 | * |
||
| 2246 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::listGlobalURLAliases |
||
| 2247 | * @depends testLookupResourceUrlAlias |
||
| 2248 | */ |
||
| 2249 | public function testListGlobalURLAliasesWithOffsetAndLimit() |
||
| 2263 | |||
| 2264 | /** |
||
| 2265 | * Test for the locationDeleted() method. |
||
| 2266 | * |
||
| 2267 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationDeleted |
||
| 2268 | */ |
||
| 2269 | public function testLocationDeleted() |
||
| 2303 | |||
| 2304 | /** |
||
| 2305 | * Test for the locationMoved() method. |
||
| 2306 | * |
||
| 2307 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved |
||
| 2308 | */ |
||
| 2309 | View Code Duplication | public function testLocationMovedHistorize() |
|
| 2340 | |||
| 2341 | /** |
||
| 2342 | * Test for the locationMoved() method. |
||
| 2343 | * |
||
| 2344 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved |
||
| 2345 | */ |
||
| 2346 | View Code Duplication | public function testLocationMovedHistory() |
|
| 2377 | |||
| 2378 | /** |
||
| 2379 | * Test for the locationMoved() method. |
||
| 2380 | * |
||
| 2381 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved |
||
| 2382 | */ |
||
| 2383 | View Code Duplication | public function testLocationMovedHistorySubtree() |
|
| 2422 | |||
| 2423 | /** |
||
| 2424 | * Test for the locationMoved() method. |
||
| 2425 | * |
||
| 2426 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved |
||
| 2427 | */ |
||
| 2428 | View Code Duplication | public function testLocationMovedReparent() |
|
| 2467 | |||
| 2468 | /** |
||
| 2469 | * Test for the locationMoved() method. |
||
| 2470 | * |
||
| 2471 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved |
||
| 2472 | * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException |
||
| 2473 | */ |
||
| 2474 | public function testLocationMovedReparentHistory() |
||
| 2484 | |||
| 2485 | /** |
||
| 2486 | * Test for the locationMoved() method. |
||
| 2487 | * |
||
| 2488 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved |
||
| 2489 | */ |
||
| 2490 | View Code Duplication | public function testLocationMovedReparentSubtree() |
|
| 2533 | |||
| 2534 | /** |
||
| 2535 | * Test for the locationMoved() method. |
||
| 2536 | * |
||
| 2537 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved |
||
| 2538 | */ |
||
| 2539 | View Code Duplication | public function testLocationMovedReparentSubtreeHistory() |
|
| 2582 | |||
| 2583 | /** |
||
| 2584 | * Test for the locationCopied() method. |
||
| 2585 | * |
||
| 2586 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationCopied |
||
| 2587 | */ |
||
| 2588 | View Code Duplication | public function testLocationCopiedCopiedLocationAliasIsValid() |
|
| 2602 | |||
| 2603 | /** |
||
| 2604 | * Test for the locationCopied() method. |
||
| 2605 | * |
||
| 2606 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationCopied |
||
| 2607 | */ |
||
| 2608 | View Code Duplication | public function testLocationCopiedCopiedSubtreeIsValid() |
|
| 2622 | |||
| 2623 | /** |
||
| 2624 | * Test for the locationCopied() method. |
||
| 2625 | * |
||
| 2626 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationCopied |
||
| 2627 | * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException |
||
| 2628 | */ |
||
| 2629 | View Code Duplication | public function testLocationCopiedHistoryNotCopied() |
|
| 2638 | |||
| 2639 | /** |
||
| 2640 | * Test for the locationCopied() method. |
||
| 2641 | * |
||
| 2642 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationCopied |
||
| 2643 | * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException |
||
| 2644 | */ |
||
| 2645 | View Code Duplication | public function testLocationCopiedSubtreeHistoryNotCopied() |
|
| 2654 | |||
| 2655 | /** |
||
| 2656 | * Test for the locationCopied() method. |
||
| 2657 | * |
||
| 2658 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationCopied |
||
| 2659 | */ |
||
| 2660 | public function testLocationCopiedSubtree() |
||
| 2709 | |||
| 2710 | /** |
||
| 2711 | * Test for the loadUrlAlias() method. |
||
| 2712 | * |
||
| 2713 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::loadUrlAlias |
||
| 2714 | * @dataProvider providerForTestLookupLocationMultipleLanguages |
||
| 2715 | */ |
||
| 2716 | View Code Duplication | public function testLoadAutogeneratedUrlAlias( |
|
| 2747 | |||
| 2748 | /** |
||
| 2749 | * Test for the loadUrlAlias() method. |
||
| 2750 | * |
||
| 2751 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::loadUrlAlias |
||
| 2752 | * @dataProvider providerForTestLookupResourceUrlAlias |
||
| 2753 | */ |
||
| 2754 | View Code Duplication | public function testLoadResourceUrlAlias( |
|
| 2786 | |||
| 2787 | /** |
||
| 2788 | * Test for the loadUrlAlias() method. |
||
| 2789 | * |
||
| 2790 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::loadUrlAlias |
||
| 2791 | * @dataProvider providerForTestLookupVirtualUrlAlias |
||
| 2792 | */ |
||
| 2793 | View Code Duplication | public function testLoadVirtualUrlAlias($url, $id) |
|
| 2802 | |||
| 2803 | protected function getHistoryAlias() |
||
| 2837 | |||
| 2838 | /** |
||
| 2839 | * Test for the loadUrlAlias() method. |
||
| 2840 | * |
||
| 2841 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::loadUrlAlias |
||
| 2842 | */ |
||
| 2843 | public function testLoadHistoryUrlAlias() |
||
| 2856 | |||
| 2857 | /** |
||
| 2858 | * Test for the loadUrlAlias() method. |
||
| 2859 | * |
||
| 2860 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::loadUrlAlias |
||
| 2861 | * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException |
||
| 2862 | */ |
||
| 2863 | public function testLoadUrlAliasThrowsNotFoundException() |
||
| 2869 | |||
| 2870 | /** |
||
| 2871 | * @return int |
||
| 2872 | */ |
||
| 2873 | protected function countRows() |
||
| 2888 | |||
| 2889 | /** |
||
| 2890 | * @return int |
||
| 2891 | */ |
||
| 2892 | protected function dump() |
||
| 2907 | |||
| 2908 | /** |
||
| 2909 | * @var \eZ\Publish\Core\Persistence\Doctrine\ConnectionHandler |
||
| 2910 | */ |
||
| 2911 | protected $dbHandler; |
||
| 2912 | |||
| 2913 | /** |
||
| 2914 | * @var \eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway |
||
| 2915 | */ |
||
| 2916 | protected $locationGateway; |
||
| 2917 | |||
| 2918 | /** |
||
| 2919 | * @param array $methods |
||
| 2920 | * |
||
| 2921 | * @return \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler|\PHPUnit_Framework_MockObject_MockObject |
||
| 2922 | */ |
||
| 2923 | protected function getPartlyMockedHandler(array $methods) |
||
| 2957 | |||
| 2958 | /** |
||
| 2959 | * @return \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler |
||
| 2960 | */ |
||
| 2961 | protected function getHandler() |
||
| 2986 | |||
| 2987 | /** |
||
| 2988 | * @return \eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway |
||
| 2989 | */ |
||
| 2990 | protected function getLocationGateway() |
||
| 3002 | |||
| 3003 | /** |
||
| 3004 | * @return \eZ\Publish\Core\Persistence\TransformationProcessor |
||
| 3005 | */ |
||
| 3006 | public function getProcessor() |
||
| 3014 | } |
||
| 3015 |