eZ\Publish\Core\Repository\Tests\Service\Integration\ContentTypeBase::testAddFieldDefinitionWithValidators PHP Method

testAddFieldDefinitionWithValidators() public method

Test for the addFieldDefinition() method.
    public function testAddFieldDefinitionWithValidators()
    {
        $contentTypeDraft = $this->createDraftContentType();
        $contentTypeService = $this->repository->getContentTypeService();
        $fieldDefCreate = $contentTypeService->newFieldDefinitionCreateStruct('tags', 'ezstring');
        $fieldDefCreate->names = array('eng-US' => 'Tags', 'ger-DE' => 'Schlagworte');
        $fieldDefCreate->descriptions = array('eng-US' => 'Tags of the blog post', 'ger-DE' => 'Schlagworte des Blog-Eintrages');
        $fieldDefCreate->fieldGroup = 'blog-meta';
        $fieldDefCreate->position = 1;
        $fieldDefCreate->isTranslatable = true;
        $fieldDefCreate->isRequired = true;
        $fieldDefCreate->isInfoCollector = false;
        $fieldDefCreate->defaultValue = 'New tags text line';
        $fieldDefCreate->validatorConfiguration = array('StringLengthValidator' => array('maxStringLength' => 255, 'minStringLength' => 128));
        $fieldDefCreate->fieldSettings = null;
        $fieldDefCreate->isSearchable = true;
        $contentTypeService->addFieldDefinition($contentTypeDraft, $fieldDefCreate);
        $loadedType = $contentTypeService->loadContentTypeDraft($contentTypeDraft->id);
        $this->assertInstanceOf('eZ\\Publish\\API\\Repository\\Values\\ContentType\\ContentTypeDraft', $loadedType);
        $this->assertAddFieldDefinitionStructValues($loadedType, $fieldDefCreate);
    }
ContentTypeBase