public function tearDown()
 {
     while (($language = array_pop($this->createdLanguages)) !== null) {
         $this->languageService->deleteLanguage($language);
     }
     parent::tearDown();
 }
 protected function setUp()
 {
     parent::setUp();
     $repository = $this->getRepository();
     $locationService = $repository->getLocationService();
     $contentService = $repository->getContentService();
     $contentTypeService = $repository->getContentTypeService();
     // Adding locations for content #58 ("Contact Us").
     // We first need to create "containers" since only one location of a content can exist at a time under the same parent.
     $contentCreateStruct1 = $contentService->newContentCreateStruct($contentTypeService->loadContentTypeByIdentifier('folder'), 'eng-GB');
     $contentCreateStruct1->setField('name', 'EZP-21906-1');
     $draft1 = $contentService->createContent($contentCreateStruct1, array($locationService->newLocationCreateStruct(2)));
     $folder1 = $contentService->publishVersion($draft1->versionInfo);
     $locationsFolder1 = $locationService->loadLocations($folder1->contentInfo);
     $contentCreateStruct2 = $contentService->newContentCreateStruct($contentTypeService->loadContentTypeByIdentifier('folder'), 'eng-GB');
     $contentCreateStruct2->setField('name', 'EZP-21906-2');
     $draft2 = $contentService->createContent($contentCreateStruct2, array($locationService->newLocationCreateStruct(2)));
     $folder2 = $contentService->publishVersion($draft2->versionInfo);
     $locationsFolder2 = $locationService->loadLocations($folder2->contentInfo);
     $feedbackFormContentInfo = $contentService->loadContentInfo(58);
     $locationCreateStruct1 = $locationService->newLocationCreateStruct($locationsFolder1[0]->id);
     $locationService->createLocation($feedbackFormContentInfo, $locationCreateStruct1);
     $locationCreateStruct2 = $locationService->newLocationCreateStruct($locationsFolder2[0]->id);
     $locationService->createLocation($feedbackFormContentInfo, $locationCreateStruct2);
 }
 public function setUp()
 {
     $setupFactory = $this->getSetupFactory();
     if (!$setupFactory instanceof LegacyElasticsearch) {
         $this->markTestIncomplete("ATM implemented only for Elasticsearch storage");
     }
     parent::setUp();
 }
 protected function setUp()
 {
     $setupFactory = $this->getSetupFactory();
     if ($setupFactory instanceof LegacyElasticsearch) {
         $this->markTestSkipped('Field Location search is not yet implemented Elasticsearch search engine');
     }
     parent::setUp();
 }
 public function setUp()
 {
     $setupFactory = $this->getSetupFactory();
     if ($setupFactory instanceof LegacySolr) {
         $this->markTestIncomplete('Not implemented for Solr Search Engine');
     }
     parent::setUp();
 }
 protected function setUp()
 {
     $setupFactory = $this->getSetupFactory();
     if ($setupFactory instanceof LegacySolr) {
         $this->markTestSkipped("Location search handler is not yet implemented for Solr storage");
     }
     parent::setUp();
 }
 protected function setUp()
 {
     $setupFactory = $this->getSetupFactory();
     if ($setupFactory instanceof LegacySolr || $setupFactory instanceof LegacyElasticsearch) {
         $this->markTestSkipped("Field Location search is not yet implemented for Solr & Elasticsearch storage");
     }
     parent::setUp();
 }
 public function setUp()
 {
     $setupFactory = $this->getSetupFactory();
     if ($setupFactory instanceof LegacyElasticsearch) {
         $this->markTestIncomplete("Not implemented for Elasticsearch Search Engine");
     }
     if (ltrim(get_class($setupFactory), '\\') === 'eZ\\Publish\\API\\Repository\\Tests\\SetupFactory\\Legacy') {
         $this->markTestSkipped("Not implemented for Legacy Search Engine");
     }
     parent::setUp();
 }
 protected function setUp()
 {
     parent::setUp();
     $repository = $this->getRepository();
     $locationService = $repository->getLocationService();
     $contentService = $repository->getContentService();
     $contentTypeService = $repository->getContentTypeService();
     $creatorId = $repository->getCurrentUser()->id;
     $creationDate = new DateTime();
     // create ContentType
     $typeCreateStruct = $contentTypeService->newContentTypeCreateStruct('test-type');
     $typeCreateStruct->names = array('eng-GB' => 'title');
     $typeCreateStruct->descriptions = array('eng-GB' => 'description');
     $typeCreateStruct->remoteId = 'new-remoteid';
     $typeCreateStruct->creatorId = $creatorId;
     $typeCreateStruct->creationDate = $creationDate;
     $typeCreateStruct->mainLanguageCode = 'eng-GB';
     $typeCreateStruct->nameSchema = '<title>';
     $typeCreateStruct->urlAliasSchema = '<title>';
     // create content fields
     $titleFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('title', 'ezstring');
     $titleFieldCreate->names = array('eng-GB' => 'title');
     $titleFieldCreate->descriptions = array('eng-GB' => 'title description');
     $titleFieldCreate->fieldGroup = 'content';
     $titleFieldCreate->position = 1;
     $titleFieldCreate->isTranslatable = true;
     $titleFieldCreate->isRequired = true;
     $titleFieldCreate->isInfoCollector = false;
     $titleFieldCreate->isSearchable = true;
     $titleFieldCreate->defaultValue = 'New text line';
     $typeCreateStruct->addFieldDefinition($titleFieldCreate);
     $objectRelationListFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('relationlist', 'ezobjectrelationlist');
     $objectRelationListFieldCreate->names = array('eng-GB' => 'object relation list');
     $objectRelationListFieldCreate->descriptions = array('eng-GB' => 'object relation list description');
     $objectRelationListFieldCreate->fieldGroup = 'content';
     $objectRelationListFieldCreate->position = 2;
     $objectRelationListFieldCreate->isTranslatable = false;
     $objectRelationListFieldCreate->isRequired = false;
     $objectRelationListFieldCreate->isInfoCollector = false;
     $objectRelationListFieldCreate->isSearchable = false;
     $objectRelationListFieldCreate->defaultValue = '';
     $typeCreateStruct->addFieldDefinition($objectRelationListFieldCreate);
     // ContentType Group
     $groupCreate = $contentTypeService->newContentTypeGroupCreateStruct('test-group');
     $groupCreate->creatorId = $creatorId;
     $groupCreate->creationDate = $creationDate;
     // create and publish ContentType
     $type = $contentTypeService->createContentType($typeCreateStruct, array($contentTypeService->createContentTypeGroup($groupCreate)));
     $contentTypeService->publishContentTypeDraft($type);
 }
 /**
  * Tests that the required <b>LocationService::loadLocation()</b>
  * at least returns an object, because this method is utilized in several
  * tests.
  *
  * @return void
  */
 protected function setUp()
 {
     parent::setUp();
     try {
         // Load the LocationService
         $locationService = $this->getRepository()->getLocationService();
         $membersUserGroupLocationId = 12;
         // Load a location instance
         $location = $locationService->loadLocation($membersUserGroupLocationId);
         if (false === is_object($location)) {
             $this->markTestSkipped('This test cannot be executed, because the utilized ' . 'LocationService::loadLocation() does not ' . 'return an object.');
         }
     } catch (Exception $e) {
         $this->markTestSkipped('This test cannot be executed, because the utilized ' . 'LocationService::loadLocation() failed with ' . PHP_EOL . PHP_EOL . $e->getTraceAsString());
     }
 }
 /**
  * Tests that the required <b>ContentService::loadContentInfoByRemoteId()</b>
  * at least returns an object, because this method is utilized in several
  * tests,.
  */
 protected function setUp()
 {
     parent::setUp();
     try {
         // RemoteId of the "Media" page of an eZ Publish demo installation
         $mediaRemoteId = 'a6e35cbcb7cd6ae4b691f3eee30cd262';
         // Load the ContentService
         $contentService = $this->getRepository()->getContentService();
         // Load a content info instance
         $contentInfo = $contentService->loadContentInfoByRemoteId($mediaRemoteId);
         if (false === is_object($contentInfo)) {
             $this->markTestSkipped('This test cannot be executed, because the utilized ' . 'ContentService::loadContentInfoByRemoteId() does not ' . 'return an object.');
         }
     } catch (Exception $e) {
         $this->markTestSkipped('This test cannot be executed, because the utilized ' . 'ContentService::loadContentInfoByRemoteId() failed with ' . PHP_EOL . PHP_EOL . $e);
     }
 }
 protected function setUp()
 {
     parent::setUp();
     $repository = $this->getRepository();
     $contentTypeService = $repository->getContentTypeService();
     $creatorId = $repository->getCurrentUser()->id;
     $creationDate = new DateTime();
     $typeCreateStruct = $contentTypeService->newContentTypeCreateStruct('new-type');
     $typeCreateStruct->names = array('eng-GB' => 'title');
     $typeCreateStruct->descriptions = array('eng-GB' => 'description');
     $typeCreateStruct->remoteId = "new-remoteid";
     $typeCreateStruct->creatorId = $creatorId;
     $typeCreateStruct->creationDate = $creationDate;
     $typeCreateStruct->mainLanguageCode = 'eng-GB';
     $typeCreateStruct->nameSchema = "<title>";
     $typeCreateStruct->urlAliasSchema = "<title>";
     $titleFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('title', 'ezstring');
     $titleFieldCreate->names = array('eng-GB' => 'title');
     $titleFieldCreate->descriptions = array('eng-GB' => 'title description');
     $titleFieldCreate->fieldGroup = 'blog-content';
     $titleFieldCreate->position = 1;
     $titleFieldCreate->isTranslatable = true;
     $titleFieldCreate->isRequired = true;
     $titleFieldCreate->isInfoCollector = false;
     $titleFieldCreate->isSearchable = true;
     $titleFieldCreate->defaultValue = "New text line";
     $typeCreateStruct->addFieldDefinition($titleFieldCreate);
     $objectRelationFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('body', 'ezobjectrelation');
     $objectRelationFieldCreate->names = array('eng-GB' => 'object relation');
     $objectRelationFieldCreate->descriptions = array('eng-GB' => 'object relation description');
     $objectRelationFieldCreate->fieldGroup = 'blog-content';
     $objectRelationFieldCreate->position = 2;
     $objectRelationFieldCreate->isTranslatable = false;
     $objectRelationFieldCreate->isRequired = false;
     $objectRelationFieldCreate->isInfoCollector = false;
     $objectRelationFieldCreate->isSearchable = false;
     $objectRelationFieldCreate->defaultValue = "";
     $typeCreateStruct->addFieldDefinition($objectRelationFieldCreate);
     $groupCreate = $contentTypeService->newContentTypeGroupCreateStruct('first-group');
     $groupCreate->creatorId = $creatorId;
     $groupCreate->creationDate = $creationDate;
     $type = $contentTypeService->createContentType($typeCreateStruct, array($contentTypeService->createContentTypeGroup($groupCreate)));
     $contentTypeService->publishContentTypeDraft($type);
     $this->contentType = $contentTypeService->loadContentType($type->id);
 }
 protected function setUp()
 {
     parent::setUp();
     $repository = $this->getRepository();
     // Loaded services
     $contentService = $repository->getContentService();
     $languageService = $repository->getContentLanguageService();
     //Create Por-PT Language
     $langCreateStruct = $languageService->newLanguageCreateStruct();
     $langCreateStruct->languageCode = 'por-PT';
     $langCreateStruct->name = 'Portuguese (portuguese)';
     $langCreateStruct->enabled = true;
     $languageService->createLanguage($langCreateStruct);
     // Translate "Image" Folder name to por-PT
     $objUpdateStruct = $contentService->newContentUpdateStruct();
     $objUpdateStruct->initialLanguageCode = "eng-US";
     $objUpdateStruct->setField("name", "Imagens", "por-PT");
     // @todo Also test always available flag?
     $draft = $contentService->updateContent($contentService->createContentDraft($contentService->loadContentInfo(49))->getVersionInfo(), $objUpdateStruct);
     $contentService->publishVersion($draft->getVersionInfo());
 }
Esempio n. 14
0
 protected function setUp()
 {
     parent::setUp();
     $repository = $this->getRepository();
     // Loaded services
     $contentTypeService = $repository->getContentTypeService();
     $contentService = $repository->getContentService();
     $locationService = $repository->getLocationService();
     $urlAliasService = $repository->getURLAliasService();
     // Create Folder News
     $contentCreateStruct = $contentService->newContentCreateStruct($contentTypeService->loadContentTypeByIdentifier('folder'), 'eng-GB');
     $contentCreateStruct->setField('name', 'TheOriginalNews');
     $contentService->publishVersion($contentService->createContent($contentCreateStruct, array($locationService->newLocationCreateStruct(2)))->versionInfo);
     // Update folder
     $contentUpdateStruct = $contentService->newContentUpdateStruct();
     $contentUpdateStruct->setField('name', 'TheUpdatedNews');
     $contentService->publishVersion($contentService->updateContent($contentService->createContentDraft($locationService->loadLocation($urlAliasService->lookup('/TheOriginalNews', 'eng-GB')->destination)->getContentInfo())->versionInfo, $contentUpdateStruct)->versionInfo);
     // Create an draft
     $contentDraftStruct = $contentService->newContentUpdateStruct();
     $contentDraftStruct->setField('name', 'TheDraftNews');
     $contentService->updateContent($contentService->createContentDraft($locationService->loadLocation($urlAliasService->lookup('/TheUpdatedNews', 'eng-GB')->destination)->getContentInfo())->versionInfo, $contentDraftStruct);
 }
 protected function setUp()
 {
     parent::setUp();
     $this->createTestContentType();
 }
 protected function tearDown()
 {
     $this->deleteTestContentType();
     parent::tearDown();
 }
 protected function setUp()
 {
     parent::setUp();
 }