Exemplo n.º 1
0
 /**
  * @test
  * @group library
  * @expectedException \Cms\Exception
  * @expectedExceptionCode 2300
  */
 public function test_checkWebsiteMaxCountQuotaShouldThrowExceptionIfMaxCountReached()
 {
     // ARRANGE
     $service = new WebsiteService('Website');
     // ACT
     $service->checkWebsiteMaxCountQuota();
 }
Exemplo n.º 2
0
 protected function initSite($siteId)
 {
     $websiteService = new WebsiteService('Website');
     $missingId = 'SITE-20b2394c-b41c-490f-1111-70bb15968c52-SITE';
     $websiteData = $websiteService->getById($missingId);
     $renderWebsite = new \Dual\Render\Website();
     $renderWebsite->setArray($websiteData->toArray());
     CurrentSite::setSite($renderWebsite);
 }
Exemplo n.º 3
0
 /**
  * @test
  * @group library
  * @group small
  * @group dev
  */
 public function test_getUsedSetSource_returnEmptySourceIfGlobalSetsDisabled()
 {
     // ARRANGE
     $this->disableGlobalSets();
     $service = new WebsiteService('Website');
     // ACT
     $usedSetSource = $service->getUsedSetSource($this->websiteId);
     $actualSourceItems = $usedSetSource->getSources();
     // ASSERT
     $this->assertInstanceOf('\\Cms\\Dao\\Website\\GlobalSetSource', $usedSetSource);
     $this->assertInternalType('array', $actualSourceItems);
     $this->assertCount(0, $actualSourceItems);
 }
Exemplo n.º 4
0
 /**
  * @param WebsiteDao|null $websiteDao
  *
  * @return \Cms\Service\Import
  */
 protected function createImportService($websiteDao = null)
 {
     $websiteService = new WebsiteService('Website');
     if ($websiteDao instanceof WebsiteDao) {
         $websiteService->setDao($websiteDao);
     }
     $importService = new ImportQuotaTestService();
     $importService->phpunitSetWebsiteService($websiteService);
     return $importService;
 }
Exemplo n.º 5
0
 /**
  * @param  string $websiteId
  * @return string
  */
 public function indexWebsite($websiteId)
 {
     $websiteService = new Website('Website');
     if (!$websiteService->existsWebsiteAlready($websiteId)) {
         throw new CmsException('602', __METHOD__, __LINE__);
     }
     // Zum Rendern muss die Business-Schicht verwendet werden
     $renderBusiness = new BusinessRender('Render');
     $modulService = new Modul('Modul');
     $pageService = new Page('Page');
     $allPageIds = $pageService->getIdsByWebsiteId($websiteId);
     $indexFileOfWebsite = $this->getIndexFileForWebsite($websiteId);
     if (is_array($allPageIds) && count($allPageIds) > 0) {
         if (file_exists($indexFileOfWebsite)) {
             $index = \Zend_Search_Lucene::open($indexFileOfWebsite);
             $numberOfIndexedDocuments = $index->numDocs();
             for ($id = 0; $id < $numberOfIndexedDocuments; ++$id) {
                 if (!$index->isDeleted($id)) {
                     $document = $index->delete($id);
                 }
             }
         } else {
             $index = \Zend_Search_Lucene::create($indexFileOfWebsite);
         }
         foreach ($allPageIds as $pageId) {
             $pageContent = $this->getPageContent($websiteId, $pageId);
             if ($this->isStoreContentEnabled()) {
                 $document = \Zend_Search_Lucene_Document_Html::loadHTML($pageContent, true, 'UTF-8');
             } else {
                 $document = \Zend_Search_Lucene_Document_Html::loadHTML($pageContent, false, 'UTF-8');
             }
             $document->addField(\Zend_Search_Lucene_Field::unIndexed('md5', md5($pageContent)));
             $document->addField(\Zend_Search_Lucene_Field::unIndexed('pageId', $pageId));
             $index->addDocument($document);
         }
         $index->commit();
         $index->optimize();
         unset($index);
     }
     return $indexFileOfWebsite;
 }
Exemplo n.º 6
0
 /**
  * @param array $attributes
  * @param null  $websiteId
  */
 public function checkWebhostingMaxCountQuota(array $attributes, $websiteId = null)
 {
     $this->phpunitTestCalls[] = array(__METHOD__, time(), array($attributes, $websiteId));
     parent::checkWebhostingMaxCountQuota($attributes, $websiteId);
 }