Ejemplo n.º 1
0
 /**
  * @test
  * @group library
  */
 public function success()
 {
     $templateId = 'TPL-42b452d6-vi2d-4b56-b52c-aeaa49e541c9-TPL';
     $websiteId = 'SITE-5sz2bve3-1cfg-4836-b847-1ab0571b1e6d-SITE';
     $template = $this->templateBusiness->getById($templateId, $websiteId);
     $templateContent = \Zend_Json::decode($template->getContent());
     \Cms\ExceptionStack::reset();
     $pageContent = $this->reparseBusiness->generateNewPageContent($template);
     $this->assertEquals(0, count(\Cms\ExceptionStack::getExceptions()), 'Exception(s) occured');
     $this->assertNotSame($templateContent, $pageContent);
     $this->checkGeneratedContent($templateContent, $pageContent);
 }
Ejemplo n.º 2
0
 public function errorAction()
 {
     $errors = $this->_getParam('error_handler');
     if ($errors === null) {
         \Cms\ExceptionStack::throwErrors();
     }
     $this->setResponseStatusCode($errors);
     if ($errors->exception instanceof \Cms\ExceptionStackException) {
         $this->handleStackExceptions($errors->exception);
         $responseData = $errors->exception->getResponseData();
     } else {
         $this->handleError($errors->exception);
         $responseData = null;
     }
     $response = $this->generateResponse($this->responseErrors, $responseData);
     $this->responseData = $response;
     \Cms\ExceptionStack::reset();
 }
Ejemplo n.º 3
0
 /**
  * @test
  * @group library
  */
 public function reparseWebsiteSuccess()
 {
     $websiteId = 'SITE-5sz2bve3-1cfg-4836-b847-1ab0571b1e6d-SITE';
     $pageService = $this->business->getService('Page');
     $allPageIds = $pageService->getIdsByWebsiteId($websiteId);
     foreach ($allPageIds as $pageId) {
         $page = $pageService->getById($pageId, $websiteId);
         $pageContent[$page->getId()] = $page->getContent();
         $templateContent[$page->getId()] = $page->getTemplatecontent();
     }
     \Cms\ExceptionStack::reset();
     $reparsedPageIds = $this->business->reparseWebsite($websiteId);
     $this->assertEquals(0, count(\Cms\ExceptionStack::getExceptions()), 'Exception(s) occured');
     $this->assertSame(2, count($reparsedPageIds));
     foreach ($allPageIds as $pageId) {
         $page = $pageService->getById($pageId, $websiteId);
         $this->assertContains($page->getId(), $reparsedPageIds);
         $this->assertNotSame($pageContent[$page->getId()], $page->getContent());
         $this->assertNotSame($templateContent[$page->getId()], $page->getTemplatecontent());
     }
 }
Ejemplo n.º 4
0
 /**
  * return the validated request object
  *
  * @param string  $controllerName
  * @param string  $actionName
  * @param boolean $setHttpErrorCode
  *
  * @return Cms_Request_Abstract|false
  */
 protected function getValidatedRequest($controllerName, $actionName, $setHttpErrorCode = false)
 {
     $actionRequest = $this->getActionRequest($controllerName, $actionName);
     $requestValidator = $this->getRequestValidator($controllerName);
     $requestIsValid = $requestValidator->validate($actionName, $actionRequest, $setHttpErrorCode);
     if (!$requestIsValid && $setHttpErrorCode) {
         $this->getResponse()->setHttpResponseCode(400);
         \Cms\ExceptionStack::reset();
         return false;
     }
     return $actionRequest;
 }
Ejemplo n.º 5
0
 protected function resetCmsExceptionStack()
 {
     \Cms\ExceptionStack::reset();
 }
Ejemplo n.º 6
0
 /**
  * Empty all theme files
  */
 public function resetTheme()
 {
     $this->createTargetDirectory();
     // empty theme files
     CmsExceptionStack::reset();
     foreach ($this->themeFileNames as $file => $target) {
         try {
             FS::rmFile(FS::joinPath($this->targetPath, $target));
         } catch (\Exception $e) {
             CmsExceptionStack::addException($e);
         }
     }
     if (CmsExceptionStack::hasErrors()) {
         CmsExceptionStack::throwErrors();
     }
 }