eZ\Publish\Core\Repository\Tests\Service\Integration\ObjectStateBase::testCreateObjectStateInEmptyGroup PHP Метод

testCreateObjectStateInEmptyGroup() публичный Метод

Test service method for creating object state in empty group.
    public function testCreateObjectStateInEmptyGroup()
    {
        $objectStateService = $this->repository->getObjectStateService();
        $groupCreateStruct = $objectStateService->newObjectStateGroupCreateStruct('test');
        $groupCreateStruct->defaultLanguageCode = 'eng-GB';
        $groupCreateStruct->names = array('eng-GB' => 'Test');
        $groupCreateStruct->descriptions = array('eng-GB' => 'Test description');
        $createdGroup = $objectStateService->createObjectStateGroup($groupCreateStruct);
        $stateCreateStruct = $objectStateService->newObjectStateCreateStruct('test');
        $stateCreateStruct->priority = 2;
        $stateCreateStruct->defaultLanguageCode = 'eng-GB';
        $stateCreateStruct->names = array('eng-GB' => 'Test');
        $stateCreateStruct->descriptions = array('eng-GB' => 'Test description');
        $createdState = $objectStateService->createObjectState($createdGroup, $stateCreateStruct);
        $this->assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectState', $createdState);
        $this->assertNotNull($createdState->id);
        $this->assertPropertiesCorrect(array('identifier' => 'test', 'priority' => 0, 'defaultLanguageCode' => 'eng-GB', 'languageCodes' => array('eng-GB'), 'names' => array('eng-GB' => 'Test'), 'descriptions' => array('eng-GB' => 'Test description')), $createdState);
        $this->assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectStateGroup', $createdState->getObjectStateGroup());
        $this->assertEquals($createdGroup->id, $createdState->getObjectStateGroup()->id);
        $this->assertGreaterThan(0, $objectStateService->getContentCount($createdState));
    }