/**
  * @covers \eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::loadGroupByIdentifier
  */
 public function testLoadGroupByIdentifier()
 {
     $group = $this->handler->loadGroupByIdentifier('ez_lock');
     $this->assertInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\ObjectState\\Group', $group);
     $this->assertEquals(2, $group->id);
     $this->assertEquals('ez_lock', $group->identifier);
     $this->assertEquals('eng-US', $group->defaultLanguage);
     $this->assertEquals(array('eng-US'), $group->languageCodes);
     $this->assertEquals(array('eng-US' => 'Lock'), $group->name);
     $this->assertEquals(array('eng-US' => ''), $group->description);
 }
 /**
  * Updates an object state group.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to update an object state group
  * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the object state group with provided identifier already exists
  *
  * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup $objectStateGroup
  * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroupUpdateStruct $objectStateGroupUpdateStruct
  *
  * @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup
  */
 public function updateObjectStateGroup(APIObjectStateGroup $objectStateGroup, ObjectStateGroupUpdateStruct $objectStateGroupUpdateStruct)
 {
     if ($this->repository->hasAccess('state', 'administrate') !== true) {
         throw new UnauthorizedException('state', 'administrate');
     }
     $loadedObjectStateGroup = $this->loadObjectStateGroup($objectStateGroup->id);
     $inputStruct = $this->buildObjectStateGroupUpdateInputStruct($loadedObjectStateGroup, $objectStateGroupUpdateStruct->identifier, $objectStateGroupUpdateStruct->defaultLanguageCode, $objectStateGroupUpdateStruct->names, $objectStateGroupUpdateStruct->descriptions);
     if ($objectStateGroupUpdateStruct->identifier !== null) {
         try {
             $existingObjectStateGroup = $this->objectStateHandler->loadGroupByIdentifier($inputStruct->identifier);
             if ($existingObjectStateGroup->id != $loadedObjectStateGroup->id) {
                 throw new InvalidArgumentException('objectStateGroupUpdateStruct', 'Object state group with provided identifier already exists');
             }
         } catch (APINotFoundException $e) {
             // Do nothing
         }
     }
     $this->repository->beginTransaction();
     try {
         $spiObjectStateGroup = $this->objectStateHandler->updateGroup($loadedObjectStateGroup->id, $inputStruct);
         $this->repository->commit();
     } catch (Exception $e) {
         $this->repository->rollback();
         throw $e;
     }
     return $this->buildDomainObjectStateGroupObject($spiObjectStateGroup);
 }