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

testUpdateFieldDefinitionThrowsInvalidArgumentExceptionFieldIdentifierExists() public method

Test for the updateFieldDefinition() method.
    public function testUpdateFieldDefinitionThrowsInvalidArgumentExceptionFieldIdentifierExists()
    {
        $contentTypeDraft = $this->createDraftContentType();
        $draftId = $contentTypeDraft->id;
        /* BEGIN: Use Case */
        // $draftId contains the ID of a content type draft
        $contentTypeService = $this->repository->getContentTypeService();
        $contentTypeDraft = $contentTypeService->loadContentTypeDraft($draftId);
        $bodyField = $contentTypeDraft->getFieldDefinition('body');
        $titleField = $contentTypeDraft->getFieldDefinition('title');
        $bodyUpdateStruct = $contentTypeService->newFieldDefinitionUpdateStruct();
        $bodyUpdateStruct->identifier = 'title';
        // Throws exception, since "title" field already exists
        $contentTypeService->updateFieldDefinition($contentTypeDraft, $bodyField, $bodyUpdateStruct);
        /* END: Use Case */
    }
ContentTypeBase