|
@@ 129-152 (lines=24) @@
|
| 126 |
|
* @see \eZ\Publish\API\Repository\URLAliasService::createUrlAlias($location, $path, $languageCode, $forwarding) |
| 127 |
|
* @depends testCreateUrlAliasPropertyValues |
| 128 |
|
*/ |
| 129 |
|
public function testCreateUrlAliasWithForwarding() |
| 130 |
|
{ |
| 131 |
|
$repository = $this->getRepository(); |
| 132 |
|
|
| 133 |
|
$locationId = $this->generateId('location', 5); |
| 134 |
|
|
| 135 |
|
/* BEGIN: Use Case */ |
| 136 |
|
// $locationId is the ID of an existing location |
| 137 |
|
|
| 138 |
|
$locationService = $repository->getLocationService(); |
| 139 |
|
$urlAliasService = $repository->getURLAliasService(); |
| 140 |
|
|
| 141 |
|
$location = $locationService->loadLocation($locationId); |
| 142 |
|
|
| 143 |
|
$createdUrlAlias = $urlAliasService->createUrlAlias($location, '/Home/My-New-Site', 'eng-US', true); |
| 144 |
|
/* END: Use Case */ |
| 145 |
|
|
| 146 |
|
$this->assertInstanceOf( |
| 147 |
|
URLAlias::class, |
| 148 |
|
$createdUrlAlias |
| 149 |
|
); |
| 150 |
|
|
| 151 |
|
return [$createdUrlAlias, $location->id]; |
| 152 |
|
} |
| 153 |
|
|
| 154 |
|
/** |
| 155 |
|
* @param array $testData |
|
@@ 185-208 (lines=24) @@
|
| 182 |
|
* |
| 183 |
|
* @see \eZ\Publish\API\Repository\URLAliasService::createUrlAlias($location, $path, $languageCode, $forwarding, $alwaysAvailable) |
| 184 |
|
*/ |
| 185 |
|
public function testCreateUrlAliasWithAlwaysAvailable() |
| 186 |
|
{ |
| 187 |
|
$repository = $this->getRepository(); |
| 188 |
|
|
| 189 |
|
$locationId = $this->generateId('location', 5); |
| 190 |
|
|
| 191 |
|
/* BEGIN: Use Case */ |
| 192 |
|
// $locationId is the ID of an existing location |
| 193 |
|
|
| 194 |
|
$locationService = $repository->getLocationService(); |
| 195 |
|
$urlAliasService = $repository->getURLAliasService(); |
| 196 |
|
|
| 197 |
|
$location = $locationService->loadLocation($locationId); |
| 198 |
|
|
| 199 |
|
$createdUrlAlias = $urlAliasService->createUrlAlias($location, '/Home/My-New-Site', 'eng-US', false, true); |
| 200 |
|
/* END: Use Case */ |
| 201 |
|
|
| 202 |
|
$this->assertInstanceOf( |
| 203 |
|
URLAlias::class, |
| 204 |
|
$createdUrlAlias |
| 205 |
|
); |
| 206 |
|
|
| 207 |
|
return [$createdUrlAlias, $location->id]; |
| 208 |
|
} |
| 209 |
|
|
| 210 |
|
/** |
| 211 |
|
* @param array $testData |
|
@@ 423-451 (lines=29) @@
|
| 420 |
|
* |
| 421 |
|
* @see \eZ\Publish\API\Repository\URLAliasService::createGlobalUrlAlias($resource, $path, $languageCode, $forwarding, $alwaysAvailable) |
| 422 |
|
*/ |
| 423 |
|
public function testCreateGlobalUrlAliasForLocation() |
| 424 |
|
{ |
| 425 |
|
$repository = $this->getRepository(); |
| 426 |
|
|
| 427 |
|
$locationId = $this->generateId('location', 5); |
| 428 |
|
$locationService = $repository->getLocationService(); |
| 429 |
|
$location = $locationService->loadLocation($locationId); |
| 430 |
|
|
| 431 |
|
/* BEGIN: Use Case */ |
| 432 |
|
// $locationId is the ID of an existing location |
| 433 |
|
|
| 434 |
|
$urlAliasService = $repository->getURLAliasService(); |
| 435 |
|
|
| 436 |
|
$createdUrlAlias = $urlAliasService->createGlobalUrlAlias( |
| 437 |
|
'module:content/view/full/' . $locationId, |
| 438 |
|
'/Home/My-New-Site-global', |
| 439 |
|
'eng-US', |
| 440 |
|
false, |
| 441 |
|
true |
| 442 |
|
); |
| 443 |
|
/* END: Use Case */ |
| 444 |
|
|
| 445 |
|
$this->assertInstanceOf( |
| 446 |
|
URLAlias::class, |
| 447 |
|
$createdUrlAlias |
| 448 |
|
); |
| 449 |
|
|
| 450 |
|
return [$createdUrlAlias, $location->id]; |
| 451 |
|
} |
| 452 |
|
|
| 453 |
|
/** |
| 454 |
|
* Test for the createUrlAlias() method. |
|
@@ 458-486 (lines=29) @@
|
| 455 |
|
* |
| 456 |
|
* @see \eZ\Publish\API\Repository\URLAliasService::createGlobalUrlAlias($resource, $path, $languageCode, $forwarding, $alwaysAvailable) |
| 457 |
|
*/ |
| 458 |
|
public function testCreateGlobalUrlAliasForLocationVariation() |
| 459 |
|
{ |
| 460 |
|
$repository = $this->getRepository(); |
| 461 |
|
|
| 462 |
|
$locationId = $this->generateId('location', 5); |
| 463 |
|
$locationService = $repository->getLocationService(); |
| 464 |
|
$location = $locationService->loadLocation($locationId); |
| 465 |
|
|
| 466 |
|
/* BEGIN: Use Case */ |
| 467 |
|
// $locationId is the ID of an existing location |
| 468 |
|
|
| 469 |
|
$urlAliasService = $repository->getURLAliasService(); |
| 470 |
|
|
| 471 |
|
$createdUrlAlias = $urlAliasService->createGlobalUrlAlias( |
| 472 |
|
'eznode:' . $locationId, |
| 473 |
|
'/Home/My-New-Site-global', |
| 474 |
|
'eng-US', |
| 475 |
|
false, |
| 476 |
|
true |
| 477 |
|
); |
| 478 |
|
/* END: Use Case */ |
| 479 |
|
|
| 480 |
|
$this->assertInstanceOf( |
| 481 |
|
URLAlias::class, |
| 482 |
|
$createdUrlAlias |
| 483 |
|
); |
| 484 |
|
|
| 485 |
|
return [$createdUrlAlias, $location->id]; |
| 486 |
|
} |
| 487 |
|
|
| 488 |
|
/** |
| 489 |
|
* @param \eZ\Publish\API\Repository\Values\Content\URLAlias |