public function testCreateContentType() { /* BEGIN: Use Case */ $contentTypeService = $this->repository->getContentTypeService(); $typeCreateStruct = $contentTypeService->newContentTypeCreateStruct('new-type'); $typeCreateStruct->names = array('eng-US' => 'American type title', 'eng-GB' => 'British type title'); $typeCreateStruct->descriptions = array('eng-US' => 'American type description', 'eng-GB' => 'British type description'); $typeCreateStruct->remoteId = 'new-remoteid'; $typeCreateStruct->creatorId = $this->repository->getCurrentUserReference()->getUserId(); $typeCreateStruct->creationDate = new \DateTime(); $typeCreateStruct->mainLanguageCode = 'eng-GB'; $typeCreateStruct->nameSchema = '<name>'; $typeCreateStruct->urlAliasSchema = '<name>'; $titleFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('title', 'ezstring'); $titleFieldCreate->names = array('eng-US' => 'American title field name', 'eng-GB' => 'British title field name'); $titleFieldCreate->descriptions = array('eng-US' => 'American title field description', 'eng-GB' => 'British title field description'); $titleFieldCreate->fieldGroup = 'blog-content'; $titleFieldCreate->position = 1; $titleFieldCreate->isTranslatable = true; $titleFieldCreate->isRequired = true; $titleFieldCreate->isInfoCollector = false; $titleFieldCreate->isSearchable = true; $titleFieldCreate->defaultValue = 'New text line'; $titleFieldCreate->validatorConfiguration = array('StringLengthValidator' => array('maxStringLength' => 128)); //$titleFieldCreate->fieldSettings $typeCreateStruct->addFieldDefinition($titleFieldCreate); $bodyFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('body', 'eztext'); $bodyFieldCreate->names = array('eng-US' => 'American body field name', 'eng-GB' => 'British body field name'); $bodyFieldCreate->descriptions = array('eng-US' => 'American body field description', 'eng-GB' => 'British body field description'); $bodyFieldCreate->fieldGroup = 'blog-content'; $bodyFieldCreate->position = 2; $bodyFieldCreate->isTranslatable = true; $bodyFieldCreate->isRequired = false; $bodyFieldCreate->isInfoCollector = false; $bodyFieldCreate->isSearchable = false; $bodyFieldCreate->defaultValue = ''; //$bodyFieldCreate->validatorConfiguration $bodyFieldCreate->fieldSettings = array('textRows' => 20); $typeCreateStruct->addFieldDefinition($bodyFieldCreate); $groups = $this->createGroups(); $type = $contentTypeService->createContentType($typeCreateStruct, $groups); /* END: Use Case */ $this->assertInstanceOf('eZ\\Publish\\API\\Repository\\Values\\ContentType\\ContentTypeDraft', $type); return array('expected' => $typeCreateStruct, 'actual' => $type, 'groups' => $groups); }