|
@@ 321-342 (lines=22) @@
|
| 318 |
|
* |
| 319 |
|
* @see \eZ\Publish\API\Repository\ObjectStateService::loadObjectStateGroup() |
| 320 |
|
*/ |
| 321 |
|
public function testLoadObjectStateGroup() |
| 322 |
|
{ |
| 323 |
|
$repository = $this->getRepository(); |
| 324 |
|
|
| 325 |
|
$objectStateGroupId = $this->generateId('objectstategroup', 2); |
| 326 |
|
/* BEGIN: Use Case */ |
| 327 |
|
// $objectStateGroupId contains the ID of the standard object state |
| 328 |
|
// group ez_lock. |
| 329 |
|
$objectStateService = $repository->getObjectStateService(); |
| 330 |
|
|
| 331 |
|
$loadedObjectStateGroup = $objectStateService->loadObjectStateGroup( |
| 332 |
|
$objectStateGroupId |
| 333 |
|
); |
| 334 |
|
/* END: Use Case */ |
| 335 |
|
|
| 336 |
|
$this->assertInstanceOf( |
| 337 |
|
'\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectStateGroup', |
| 338 |
|
$loadedObjectStateGroup |
| 339 |
|
); |
| 340 |
|
|
| 341 |
|
return $loadedObjectStateGroup; |
| 342 |
|
} |
| 343 |
|
|
| 344 |
|
/** |
| 345 |
|
* Test for the loadObjectStateGroup() method. |
|
@@ 849-869 (lines=21) @@
|
| 846 |
|
* @see \eZ\Publish\API\Repository\ObjectStateService::loadObjectState() |
| 847 |
|
* @depends testLoadObjectStateGroup |
| 848 |
|
*/ |
| 849 |
|
public function testLoadObjectState() |
| 850 |
|
{ |
| 851 |
|
$repository = $this->getRepository(); |
| 852 |
|
|
| 853 |
|
$objectStateId = $this->generateId('objectstate', 2); |
| 854 |
|
/* BEGIN: Use Case */ |
| 855 |
|
// $objectStateId contains the ID of the "locked" state |
| 856 |
|
$objectStateService = $repository->getObjectStateService(); |
| 857 |
|
|
| 858 |
|
$loadedObjectState = $objectStateService->loadObjectState( |
| 859 |
|
$objectStateId |
| 860 |
|
); |
| 861 |
|
/* END: Use Case */ |
| 862 |
|
|
| 863 |
|
$this->assertInstanceOf( |
| 864 |
|
'eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectState', |
| 865 |
|
$loadedObjectState |
| 866 |
|
); |
| 867 |
|
|
| 868 |
|
return $loadedObjectState; |
| 869 |
|
} |
| 870 |
|
|
| 871 |
|
/** |
| 872 |
|
* testLoadObjectStateStructValues. |
|
@@ 1300-1315 (lines=16) @@
|
| 1297 |
|
* @see \eZ\Publish\API\Repository\ObjectStateService::getContentCount() |
| 1298 |
|
* @depends testLoadObjectState |
| 1299 |
|
*/ |
| 1300 |
|
public function testGetContentCount() |
| 1301 |
|
{ |
| 1302 |
|
$repository = $this->getRepository(); |
| 1303 |
|
|
| 1304 |
|
$notLockedObjectStateId = $this->generateId('objectstate', 1); |
| 1305 |
|
/* BEGIN: Use Case */ |
| 1306 |
|
// $notLockedObjectStateId is the ID of the state "not_locked" |
| 1307 |
|
$objectStateService = $repository->getObjectStateService(); |
| 1308 |
|
|
| 1309 |
|
$notLockedObjectState = $objectStateService->loadObjectState($notLockedObjectStateId); |
| 1310 |
|
|
| 1311 |
|
$objectCount = $objectStateService->getContentCount($notLockedObjectState); |
| 1312 |
|
/* END: Use Case */ |
| 1313 |
|
|
| 1314 |
|
$this->assertEquals(18, $objectCount); |
| 1315 |
|
} |
| 1316 |
|
|
| 1317 |
|
/** |
| 1318 |
|
* Test for the deleteObjectState() method. |