public function testUpdateContentMetadata()
{
// Create one additional location for content to be set as main location
$locationService = $this->repository->getLocationService();
$contentInfo = $this->repository->getContentService()->loadContentInfo(12);
$locationCreateStruct = $locationService->newLocationCreateStruct(44);
$locationCreateStruct->remoteId = 'test-location-remote-id-1234';
$newLocation = $locationService->createLocation($contentInfo, $locationCreateStruct);
$newSectionId = $this->repository->getContentService()->loadContentInfo($locationService->loadLocation($newLocation->parentLocationId)->contentId)->sectionId;
// Change content section to be different from new main location parent location content
$sectionService = $this->repository->getSectionService();
$sectionService->assignSection($contentInfo, $sectionService->loadSection($newSectionId === 1 ? $newSectionId + 1 : $newSectionId - 1));
/* BEGIN: Use Case */
$contentService = $this->repository->getContentService();
$contentInfo = $contentService->loadContentInfo(12);
$newMainLocationId = $newLocation->id;
$time = time();
$contentMetadataUpdateStruct = $contentService->newContentMetadataUpdateStruct();
$contentMetadataUpdateStruct->ownerId = 10;
$contentMetadataUpdateStruct->publishedDate = $this->getDateTime($time);
$contentMetadataUpdateStruct->modificationDate = $this->getDateTime($time);
$contentMetadataUpdateStruct->mainLanguageCode = 'eng-GB';
$contentMetadataUpdateStruct->alwaysAvailable = false;
$contentMetadataUpdateStruct->remoteId = 'the-all-new-remoteid';
$contentMetadataUpdateStruct->mainLocationId = $newMainLocationId;
$content = $contentService->updateContentMetadata($contentInfo, $contentMetadataUpdateStruct);
/* END: Use Case */
$this->assertInstanceOf('eZ\\Publish\\API\\Repository\\Values\\Content\\Content', $content);
return array('expected' => $contentMetadataUpdateStruct, 'actual' => $content, 'newSectionId' => $newSectionId);
}