|
@@ 536-556 (lines=21) @@
|
| 533 |
|
* @see \eZ\Publish\API\Repository\RoleService::loadRoleDraft() |
| 534 |
|
* @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testCreateRoleDraft |
| 535 |
|
*/ |
| 536 |
|
public function testLoadRoleDraft() |
| 537 |
|
{ |
| 538 |
|
$repository = $this->getRepository(); |
| 539 |
|
|
| 540 |
|
/* BEGIN: Use Case */ |
| 541 |
|
|
| 542 |
|
$roleService = $repository->getRoleService(); |
| 543 |
|
$roleCreate = $roleService->newRoleCreateStruct('roleName'); |
| 544 |
|
|
| 545 |
|
// @todo uncomment when support for multilingual names and descriptions is added EZP-24776 |
| 546 |
|
// $roleCreate->mainLanguageCode = 'eng-US'; |
| 547 |
|
|
| 548 |
|
$roleDraft = $roleService->createRole($roleCreate); |
| 549 |
|
|
| 550 |
|
// Load the newly created role by its ID |
| 551 |
|
$role = $roleService->loadRoleDraft($roleDraft->id); |
| 552 |
|
|
| 553 |
|
/* END: Use Case */ |
| 554 |
|
|
| 555 |
|
$this->assertEquals('roleName', $role->identifier); |
| 556 |
|
} |
| 557 |
|
|
| 558 |
|
public function testLoadRoleDraftByRoleId() |
| 559 |
|
{ |
|
@@ 943-961 (lines=19) @@
|
| 940 |
|
* @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException |
| 941 |
|
* @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testLoadRoleDraft |
| 942 |
|
*/ |
| 943 |
|
public function testDeleteRoleDraft() |
| 944 |
|
{ |
| 945 |
|
$repository = $this->getRepository(); |
| 946 |
|
|
| 947 |
|
/* BEGIN: Use Case */ |
| 948 |
|
$roleService = $repository->getRoleService(); |
| 949 |
|
$roleCreate = $roleService->newRoleCreateStruct('newRole'); |
| 950 |
|
|
| 951 |
|
// @todo uncomment when support for multilingual names and descriptions is added EZP-24776 |
| 952 |
|
// $roleCreate->mainLanguageCode = 'eng-US'; |
| 953 |
|
|
| 954 |
|
$roleDraft = $roleService->createRole($roleCreate); |
| 955 |
|
$roleID = $roleDraft->id; |
| 956 |
|
$roleService->deleteRoleDraft($roleDraft); |
| 957 |
|
|
| 958 |
|
// This call will fail with a NotFoundException, because the draft no longer exists |
| 959 |
|
$roleService->loadRoleDraft($roleID); |
| 960 |
|
/* END: Use Case */ |
| 961 |
|
} |
| 962 |
|
|
| 963 |
|
/** |
| 964 |
|
* Test for the newPolicyCreateStruct() method. |