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

testCreateContent() public method

Test for the createContent() method.
public testCreateContent ( ) : array
return array
    public function testCreateContent()
    {
        $time = time();
        $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_translatable', 'and thumbs opposable', 'eng-US');
        $contentCreate->sectionId = 1;
        $contentCreate->ownerId = $this->repository->getCurrentUserReference()->getUserId();
        $contentCreate->remoteId = 'abcdef0123456789abcdef0123456789';
        $contentCreate->alwaysAvailable = true;
        $locationCreates = array(new LocationCreateStruct(array('remoteId' => 'db787a9143f57828dd4331573466a013', 'parentLocationId' => 2)), new LocationCreateStruct(array('remoteId' => 'a3dd7c1c9e04c89e446a70f647286e6b', 'parentLocationId' => 5)));
        $contentDraft = $contentService->createContent($contentCreate, $locationCreates);
        /* END: Use Case */
        $this->assertInstanceOf('eZ\\Publish\\API\\Repository\\Values\\Content\\Content', $contentDraft);
        return array('expected' => $contentCreate, 'actual' => $contentDraft, 'loadedActual' => $contentService->loadContent($contentDraft->id, null, 1), 'contentType' => $testContentType, 'time' => $time);
    }
ContentBase