| @@ 372-387 (lines=16) @@ | ||
| 369 | * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException |
|
| 370 | * @covers \eZ\Publish\API\Repository\ObjectStateService::updateObjectStateGroup |
|
| 371 | */ |
|
| 372 | public function testUpdateObjectStateGroupThrowsInvalidArgumentException() |
|
| 373 | { |
|
| 374 | $objectStateService = $this->repository->getObjectStateService(); |
|
| 375 | ||
| 376 | $groupCreateStruct = $objectStateService->newObjectStateGroupCreateStruct('test'); |
|
| 377 | $groupCreateStruct->defaultLanguageCode = 'eng-GB'; |
|
| 378 | $groupCreateStruct->names = array('eng-GB' => 'Test'); |
|
| 379 | $groupCreateStruct->descriptions = array('eng-GB' => 'Test description'); |
|
| 380 | ||
| 381 | $createdGroup = $objectStateService->createObjectStateGroup($groupCreateStruct); |
|
| 382 | ||
| 383 | $groupUpdateStruct = $objectStateService->newObjectStateGroupUpdateStruct(); |
|
| 384 | $groupUpdateStruct->identifier = 'ez_lock'; |
|
| 385 | ||
| 386 | $objectStateService->updateObjectStateGroup($createdGroup, $groupUpdateStruct); |
|
| 387 | } |
|
| 388 | ||
| 389 | /** |
|
| 390 | * Test service method for deleting object state group. |
|
| @@ 779-811 (lines=33) @@ | ||
| 776 | * @depends testLoadObjectStateGroup |
|
| 777 | * @depends testCreateObjectState |
|
| 778 | */ |
|
| 779 | public function testCreateObjectStateThrowsInvalidArgumentException() |
|
| 780 | { |
|
| 781 | $repository = $this->getRepository(); |
|
| 782 | ||
| 783 | $objectStateGroupId = $this->generateId('objectstategroup', 2); |
|
| 784 | // $objectStateGroupId contains the ID of the standard object state |
|
| 785 | // group ez_lock. |
|
| 786 | $objectStateService = $repository->getObjectStateService(); |
|
| 787 | ||
| 788 | $loadedObjectStateGroup = $objectStateService->loadObjectStateGroup( |
|
| 789 | $objectStateGroupId |
|
| 790 | ); |
|
| 791 | ||
| 792 | $objectStateCreateStruct = $objectStateService->newObjectStateCreateStruct( |
|
| 793 | // 'not_locked' is the identifier of already existing state |
|
| 794 | 'not_locked' |
|
| 795 | ); |
|
| 796 | $objectStateCreateStruct->priority = 23; |
|
| 797 | $objectStateCreateStruct->defaultLanguageCode = 'eng-US'; |
|
| 798 | $objectStateCreateStruct->names = array( |
|
| 799 | 'eng-US' => 'Locked and Unlocked', |
|
| 800 | ); |
|
| 801 | $objectStateCreateStruct->descriptions = array( |
|
| 802 | 'eng-US' => 'A state between locked and unlocked.', |
|
| 803 | ); |
|
| 804 | ||
| 805 | // This call will fail because object state with |
|
| 806 | // 'not_locked' identifier already exists |
|
| 807 | $objectStateService->createObjectState( |
|
| 808 | $loadedObjectStateGroup, |
|
| 809 | $objectStateCreateStruct |
|
| 810 | ); |
|
| 811 | } |
|
| 812 | ||
| 813 | /** |
|
| 814 | * testCreateObjectStateStructValues. |
|