/** * @param string $websiteId * * @return \Cms\Data\Page[] */ private function getAllPages($websiteId) { $allPages = array(); $allIds = $this->service->getIdsByWebsiteId($websiteId); foreach ($allIds as $pageId) { $allPages[$pageId] = $this->service->getById($pageId, $websiteId); } return $allPages; }
/** * @test * @group small * @group dev * @group library */ public function test_updateAllContentsOfWebsite_success() { // ARRANGE $websiteId = 'SITE-update00-defa-ult0-form-values000001-SITE'; $templateSnippetId = 'TPLS-update00-defa-ult0-form-values000001-TPLS'; $templateId = 'TPL-update00-defa-ult0-form-values000001-TPL'; $pageId = 'PAGE-update00-defa-ult0-form-values000001-PAGE'; $orgTemplateContentChecksum = 'theoriginaltemplatechecksum'; $contentUpdaterBusiness = new ContentUpdaterBusiness('ContentUpdater'); $templateSnippetService = new TemplateSnippetService('TemplateSnippet'); $templateService = new TemplateService('Template'); $pageService = new PageService('Page'); $expectedSnippetContent = json_decode(FS::readContentFromFile(FS::joinPath($this->jsonFilesDirectory, 'expected_templatesnippet_content.json'))); $expectedTemplateContent = json_decode(FS::readContentFromFile(FS::joinPath($this->jsonFilesDirectory, 'expected_template_content.json'))); $expectedPageContent = json_decode(FS::readContentFromFile(FS::joinPath($this->jsonFilesDirectory, 'expected_page_1_content.json'))); // ACT $contentUpdaterBusiness->updateAllContentsOfWebsite($websiteId); // ASSERT $snippet = $templateSnippetService->getById($websiteId, $templateSnippetId); $actualSnippetContent = json_decode($snippet->getContent()); $this->assertEquals($expectedSnippetContent, $actualSnippetContent); $template = $templateService->getById($templateId, $websiteId); $this->assertNotSame($orgTemplateContentChecksum, $template->getContentchecksum()); $actualTemplateContent = json_decode($template->getContent()); $this->assertEquals($expectedTemplateContent, $actualTemplateContent); $page = $pageService->getById($pageId, $websiteId); $this->assertNotSame($orgTemplateContentChecksum, $page->getTemplatecontentchecksum()); $actualPageContent = json_decode($page->getContent()); $this->assertFormValuesOfPageContent($expectedPageContent, $actualPageContent); }
public function setUp() { parent::setUp(); $pageService = new PageService('Page'); $this->page = $pageService->getById('PAGE-033d84e8-cc3e-4a1f-a408-b8fa374af75f-PAGE', $this->websiteId); $templateService = new TemplateService('Template'); $this->template = $templateService->getById('TPL-0db7eaa7-7fc5-464a-bd47-16b3b8af67eb-TPL', $this->websiteId); }