Exemplo n.º 1
0
 /**
  * @test
  * @group library
  */
 public function updateShouldReparseLinkedPages()
 {
     $pageId = 'PAGE-133d84e8-cc3e-4a1f-a408-b8fa374af75f-PAGE';
     $websiteId = 'SITE-4sz2bve3-1cfg-4836-b847-1ab0571b1e6d-SITE';
     $templateId = 'TPL-0db7eaa7-7fc5-464a-bd47-16b3b8af67eb-TPL';
     $pageIdWithOtherTemplate = 'PAGE-233d84e8-cc3e-4a1f-a408-b8fa374af75f-PAGE';
     $template = $this->business->getById($templateId, $websiteId);
     $templateContentOrg = $template->getContent();
     $page = $this->business->getService('Page')->getById($pageId, $websiteId);
     $pageTemplateContentOrg = $page->getTemplateContent();
     // Page und Template Content zum Start des Tests unterschiedlich
     if ($templateContentOrg == $pageTemplateContentOrg) {
         $template = $this->business->update($templateId, $websiteId, array('content' => '[]'));
         $templateContentOrg = $template->getContent();
     }
     $this->assertNotSame($templateContentOrg, $pageTemplateContentOrg);
     // Page mit anderem Template betrifft die Aenderung nicht
     $pageWithOtherTemplate = $this->business->getService('Page')->getById($pageIdWithOtherTemplate, $websiteId);
     $pageWithOtherTemplateContentOrg = $pageWithOtherTemplate->getTemplateContent();
     $this->assertNotSame($pageWithOtherTemplateContentOrg, $templateContentOrg);
     // Template neu speichern
     $templateAfterUpdate = $this->business->update($templateId, $websiteId, array());
     $pageAfterTemplateUpdate = $this->business->getService('Page')->getById($pageId, $websiteId);
     // Page und TEmplate Content gleich
     $this->assertSame($templateAfterUpdate->getContent(), $pageAfterTemplateUpdate->getTemplateContent());
     // Page mit anderen Template nicht betroffen vom Update
     $pageWithOtherTemplate = $this->business->getService('Page')->getById($pageIdWithOtherTemplate, $websiteId);
     $pageWithOtherTemplateContentAfterUpdate = $pageWithOtherTemplate->getTemplateContent();
     $this->assertSame($pageWithOtherTemplateContentOrg, $pageWithOtherTemplateContentAfterUpdate);
 }
Exemplo n.º 2
0
 /**
  * @param \Cms\Business\Template $templateBusiness
  * @param string $websiteId
  *
  * @return array
  */
 protected function getTemplateIdsByWebsiteId($templateBusiness, $websiteId)
 {
     try {
         return $templateBusiness->getIdsByWebsiteId($websiteId);
     } catch (\Exception $doNothing) {
     }
     return array();
 }