eZ\Publish\Core\Repository\Tests\Service\Integration\ContentBase::testCreateContentThrowsContentValidationExceptionFieldDefinitionUnexisting PHP Метод

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

Test for the createContent() method.
    public function testCreateContentThrowsContentValidationExceptionFieldDefinitionUnexisting()
    {
        $testContentType = $this->createTestContentType();
        /* BEGIN: Use Case */
        $contentService = $this->repository->getContentService();
        $contentCreate = $contentService->newContentCreateStruct($testContentType, 'eng-GB');
        $contentCreate->setField('test_required_empty', 'value for field definition with empty default value');
        $contentCreate->setField('humpty_dumpty', 'no such field definition');
        $contentCreate->sectionId = 1;
        $contentCreate->ownerId = 14;
        $contentCreate->remoteId = 'abcdef0123456789abcdef0123456789';
        $contentCreate->alwaysAvailable = true;
        // Throws an exception because field definition with identifier "humpty_dumpty" does not exist
        $contentService->createContent($contentCreate);
        /* END: Use Case */
    }
ContentBase