eZ\Publish\Core\Repository\Tests\Service\Integration\ContentBase::testCreateContentThrowsContentFieldValidationException PHP Method

testCreateContentThrowsContentFieldValidationException() public method

Test for the createContent() method.
    public function testCreateContentThrowsContentFieldValidationException()
    {
        $testContentType = $this->createTestContentType();
        /* BEGIN: Use Case */
        $contentService = $this->repository->getContentService();
        $contentCreate = $contentService->newContentCreateStruct($testContentType, 'eng-GB');
        $contentCreate->setField('test_required_empty', 'a string that is too long and will not validate 12345678901234567890123456789012345678901234567890');
        $contentCreate->setField('test_translatable', 'and thumbs opposable', 'eng-US');
        $contentCreate->sectionId = 1;
        $contentCreate->ownerId = 14;
        $contentCreate->remoteId = 'abcdef0123456789abcdef0123456789';
        $contentCreate->alwaysAvailable = true;
        // Throws an exception because "test_required_empty" field value is too long and fails
        // field definition's string length validator
        $contentService->createContent($contentCreate);
        /* END: Use Case */
    }
ContentBase