|
@@ 944-964 (lines=21) @@
|
| 941 |
|
* @see \eZ\Publish\API\Repository\ObjectStateService::loadObjectState() |
| 942 |
|
* @depends testLoadObjectStateGroup |
| 943 |
|
*/ |
| 944 |
|
public function testLoadObjectState() |
| 945 |
|
{ |
| 946 |
|
$repository = $this->getRepository(); |
| 947 |
|
|
| 948 |
|
$objectStateId = $this->generateId('objectstate', 2); |
| 949 |
|
/* BEGIN: Use Case */ |
| 950 |
|
// $objectStateId contains the ID of the "locked" state |
| 951 |
|
$objectStateService = $repository->getObjectStateService(); |
| 952 |
|
|
| 953 |
|
$loadedObjectState = $objectStateService->loadObjectState( |
| 954 |
|
$objectStateId |
| 955 |
|
); |
| 956 |
|
/* END: Use Case */ |
| 957 |
|
|
| 958 |
|
$this->assertInstanceOf( |
| 959 |
|
'eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectState', |
| 960 |
|
$loadedObjectState |
| 961 |
|
); |
| 962 |
|
|
| 963 |
|
return $loadedObjectState; |
| 964 |
|
} |
| 965 |
|
|
| 966 |
|
/** |
| 967 |
|
* testLoadObjectStateStructValues. |
|
@@ 1429-1444 (lines=16) @@
|
| 1426 |
|
* @see \eZ\Publish\API\Repository\ObjectStateService::getContentCount() |
| 1427 |
|
* @depends testLoadObjectState |
| 1428 |
|
*/ |
| 1429 |
|
public function testGetContentCount() |
| 1430 |
|
{ |
| 1431 |
|
$repository = $this->getRepository(); |
| 1432 |
|
|
| 1433 |
|
$notLockedObjectStateId = $this->generateId('objectstate', 1); |
| 1434 |
|
/* BEGIN: Use Case */ |
| 1435 |
|
// $notLockedObjectStateId is the ID of the state "not_locked" |
| 1436 |
|
$objectStateService = $repository->getObjectStateService(); |
| 1437 |
|
|
| 1438 |
|
$notLockedObjectState = $objectStateService->loadObjectState($notLockedObjectStateId); |
| 1439 |
|
|
| 1440 |
|
$objectCount = $objectStateService->getContentCount($notLockedObjectState); |
| 1441 |
|
/* END: Use Case */ |
| 1442 |
|
|
| 1443 |
|
$this->assertEquals(18, $objectCount); |
| 1444 |
|
} |
| 1445 |
|
|
| 1446 |
|
/** |
| 1447 |
|
* Test for the deleteObjectState() method. |