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

testRemoveFieldDefinitionThrowsInvalidArgumentExceptionVariation() public method

Test for the removeFieldDefinition() method.
    public function testRemoveFieldDefinitionThrowsInvalidArgumentExceptionVariation()
    {
        $draftId = $this->createDraftContentType()->id;
        $secondDraftId = $this->createDraftContentType()->id;
        /* BEGIN: Use Case */
        // $draftId and $secondDraftId contain the ids of a different content type drafts that both have "body" field
        $contentTypeService = $this->repository->getContentTypeService();
        $contentTypeDraft = $contentTypeService->loadContentTypeDraft($draftId);
        $secondContentTypeDraft = $contentTypeService->loadContentTypeDraft($secondDraftId);
        $bodyField = $secondContentTypeDraft->getFieldDefinition('body');
        // Throws an exception because $bodyField field belongs to another draft
        $contentTypeService->removeFieldDefinition($contentTypeDraft, $bodyField);
        /* END: Use Case */
    }
ContentTypeBase