|
@@ 157-180 (lines=24) @@
|
| 154 |
|
* @see \eZ\Publish\API\Repository\URLAliasService::createUrlAlias($location, $path, $languageCode, $forwarding) |
| 155 |
|
* @depends testCreateUrlAliasPropertyValues |
| 156 |
|
*/ |
| 157 |
|
public function testCreateUrlAliasWithForwarding() |
| 158 |
|
{ |
| 159 |
|
$repository = $this->getRepository(); |
| 160 |
|
|
| 161 |
|
$locationId = $this->generateId('location', 5); |
| 162 |
|
|
| 163 |
|
/* BEGIN: Use Case */ |
| 164 |
|
// $locationId is the ID of an existing location |
| 165 |
|
|
| 166 |
|
$locationService = $repository->getLocationService(); |
| 167 |
|
$urlAliasService = $repository->getURLAliasService(); |
| 168 |
|
|
| 169 |
|
$location = $locationService->loadLocation($locationId); |
| 170 |
|
|
| 171 |
|
$createdUrlAlias = $urlAliasService->createUrlAlias($location, '/Home/My-New-Site', 'eng-US', true); |
| 172 |
|
/* END: Use Case */ |
| 173 |
|
|
| 174 |
|
$this->assertInstanceOf( |
| 175 |
|
URLAlias::class, |
| 176 |
|
$createdUrlAlias |
| 177 |
|
); |
| 178 |
|
|
| 179 |
|
return [$createdUrlAlias, $location->id]; |
| 180 |
|
} |
| 181 |
|
|
| 182 |
|
/** |
| 183 |
|
* @param array $testData |
|
@@ 213-236 (lines=24) @@
|
| 210 |
|
* |
| 211 |
|
* @see \eZ\Publish\API\Repository\URLAliasService::createUrlAlias($location, $path, $languageCode, $forwarding, $alwaysAvailable) |
| 212 |
|
*/ |
| 213 |
|
public function testCreateUrlAliasWithAlwaysAvailable() |
| 214 |
|
{ |
| 215 |
|
$repository = $this->getRepository(); |
| 216 |
|
|
| 217 |
|
$locationId = $this->generateId('location', 5); |
| 218 |
|
|
| 219 |
|
/* BEGIN: Use Case */ |
| 220 |
|
// $locationId is the ID of an existing location |
| 221 |
|
|
| 222 |
|
$locationService = $repository->getLocationService(); |
| 223 |
|
$urlAliasService = $repository->getURLAliasService(); |
| 224 |
|
|
| 225 |
|
$location = $locationService->loadLocation($locationId); |
| 226 |
|
|
| 227 |
|
$createdUrlAlias = $urlAliasService->createUrlAlias($location, '/Home/My-New-Site', 'eng-US', false, true); |
| 228 |
|
/* END: Use Case */ |
| 229 |
|
|
| 230 |
|
$this->assertInstanceOf( |
| 231 |
|
URLAlias::class, |
| 232 |
|
$createdUrlAlias |
| 233 |
|
); |
| 234 |
|
|
| 235 |
|
return [$createdUrlAlias, $location->id]; |
| 236 |
|
} |
| 237 |
|
|
| 238 |
|
/** |
| 239 |
|
* @param array $testData |
|
@@ 452-480 (lines=29) @@
|
| 449 |
|
* |
| 450 |
|
* @see \eZ\Publish\API\Repository\URLAliasService::createGlobalUrlAlias($resource, $path, $languageCode, $forwarding, $alwaysAvailable) |
| 451 |
|
*/ |
| 452 |
|
public function testCreateGlobalUrlAliasForLocation() |
| 453 |
|
{ |
| 454 |
|
$repository = $this->getRepository(); |
| 455 |
|
|
| 456 |
|
$locationId = $this->generateId('location', 5); |
| 457 |
|
$locationService = $repository->getLocationService(); |
| 458 |
|
$location = $locationService->loadLocation($locationId); |
| 459 |
|
|
| 460 |
|
/* BEGIN: Use Case */ |
| 461 |
|
// $locationId is the ID of an existing location |
| 462 |
|
|
| 463 |
|
$urlAliasService = $repository->getURLAliasService(); |
| 464 |
|
|
| 465 |
|
$createdUrlAlias = $urlAliasService->createGlobalUrlAlias( |
| 466 |
|
'module:content/view/full/' . $locationId, |
| 467 |
|
'/Home/My-New-Site-global', |
| 468 |
|
'eng-US', |
| 469 |
|
false, |
| 470 |
|
true |
| 471 |
|
); |
| 472 |
|
/* END: Use Case */ |
| 473 |
|
|
| 474 |
|
$this->assertInstanceOf( |
| 475 |
|
URLAlias::class, |
| 476 |
|
$createdUrlAlias |
| 477 |
|
); |
| 478 |
|
|
| 479 |
|
return [$createdUrlAlias, $location->id]; |
| 480 |
|
} |
| 481 |
|
|
| 482 |
|
/** |
| 483 |
|
* Test for the createUrlAlias() method. |
|
@@ 487-515 (lines=29) @@
|
| 484 |
|
* |
| 485 |
|
* @see \eZ\Publish\API\Repository\URLAliasService::createGlobalUrlAlias($resource, $path, $languageCode, $forwarding, $alwaysAvailable) |
| 486 |
|
*/ |
| 487 |
|
public function testCreateGlobalUrlAliasForLocationVariation() |
| 488 |
|
{ |
| 489 |
|
$repository = $this->getRepository(); |
| 490 |
|
|
| 491 |
|
$locationId = $this->generateId('location', 5); |
| 492 |
|
$locationService = $repository->getLocationService(); |
| 493 |
|
$location = $locationService->loadLocation($locationId); |
| 494 |
|
|
| 495 |
|
/* BEGIN: Use Case */ |
| 496 |
|
// $locationId is the ID of an existing location |
| 497 |
|
|
| 498 |
|
$urlAliasService = $repository->getURLAliasService(); |
| 499 |
|
|
| 500 |
|
$createdUrlAlias = $urlAliasService->createGlobalUrlAlias( |
| 501 |
|
'eznode:' . $locationId, |
| 502 |
|
'/Home/My-New-Site-global', |
| 503 |
|
'eng-US', |
| 504 |
|
false, |
| 505 |
|
true |
| 506 |
|
); |
| 507 |
|
/* END: Use Case */ |
| 508 |
|
|
| 509 |
|
$this->assertInstanceOf( |
| 510 |
|
URLAlias::class, |
| 511 |
|
$createdUrlAlias |
| 512 |
|
); |
| 513 |
|
|
| 514 |
|
return [$createdUrlAlias, $location->id]; |
| 515 |
|
} |
| 516 |
|
|
| 517 |
|
/** |
| 518 |
|
* @param \eZ\Publish\API\Repository\Values\Content\URLAlias |