|
@@ 839-859 (lines=21) @@
|
| 836 |
|
* @see \eZ\Publish\API\Repository\ObjectStateService::loadObjectState() |
| 837 |
|
* @depends testLoadObjectStateGroup |
| 838 |
|
*/ |
| 839 |
|
public function testLoadObjectState() |
| 840 |
|
{ |
| 841 |
|
$repository = $this->getRepository(); |
| 842 |
|
|
| 843 |
|
$objectStateId = $this->generateId('objectstate', 2); |
| 844 |
|
/* BEGIN: Use Case */ |
| 845 |
|
// $objectStateId contains the ID of the "locked" state |
| 846 |
|
$objectStateService = $repository->getObjectStateService(); |
| 847 |
|
|
| 848 |
|
$loadedObjectState = $objectStateService->loadObjectState( |
| 849 |
|
$objectStateId |
| 850 |
|
); |
| 851 |
|
/* END: Use Case */ |
| 852 |
|
|
| 853 |
|
$this->assertInstanceOf( |
| 854 |
|
'eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectState', |
| 855 |
|
$loadedObjectState |
| 856 |
|
); |
| 857 |
|
|
| 858 |
|
return $loadedObjectState; |
| 859 |
|
} |
| 860 |
|
|
| 861 |
|
/** |
| 862 |
|
* testLoadObjectStateStructValues. |
|
@@ 1280-1295 (lines=16) @@
|
| 1277 |
|
* @see \eZ\Publish\API\Repository\ObjectStateService::getContentCount() |
| 1278 |
|
* @depends testLoadObjectState |
| 1279 |
|
*/ |
| 1280 |
|
public function testGetContentCount() |
| 1281 |
|
{ |
| 1282 |
|
$repository = $this->getRepository(); |
| 1283 |
|
|
| 1284 |
|
$notLockedObjectStateId = $this->generateId('objectstate', 1); |
| 1285 |
|
/* BEGIN: Use Case */ |
| 1286 |
|
// $notLockedObjectStateId is the ID of the state "not_locked" |
| 1287 |
|
$objectStateService = $repository->getObjectStateService(); |
| 1288 |
|
|
| 1289 |
|
$notLockedObjectState = $objectStateService->loadObjectState($notLockedObjectStateId); |
| 1290 |
|
|
| 1291 |
|
$objectCount = $objectStateService->getContentCount($notLockedObjectState); |
| 1292 |
|
/* END: Use Case */ |
| 1293 |
|
|
| 1294 |
|
$this->assertEquals(18, $objectCount); |
| 1295 |
|
} |
| 1296 |
|
|
| 1297 |
|
/** |
| 1298 |
|
* Test for the deleteObjectState() method. |
|
@@ 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. |