public testCreateContentThrowsContentValidationExceptionUntranslatableField ( ) : array | ||
Результат | array |
public function testCreateContentThrowsContentValidationExceptionUntranslatableField()
{
$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('test_untranslatable', 'Bandersnatch', 'eng-US');
$contentCreate->sectionId = 1;
$contentCreate->ownerId = 14;
$contentCreate->remoteId = 'abcdef0123456789abcdef0123456789';
$contentCreate->alwaysAvailable = true;
// Throws an exception because translation was given for a untranslatable field
// Note that it is still permissible to set untranslatable field with main language
$contentService->createContent($contentCreate);
/* END: Use Case */
}