/** * @test * @group small * @group dev * @group library */ public function test_updateDefaultFormValuesOfTemplate_success() { // ARRANGE $websiteId = 'SITE-update00-defa-ult0-form-values000001-SITE'; $templateSnippetId = 'TPLS-update00-defa-ult0-form-values000001-TPLS'; $contentUpdaterService = new ContentUpdaterService('ContentUpdater'); $templateSnippetService = new TemplateSnippetService('TemplateSnippet'); $expectedContent = json_decode(FS::readContentFromFile(FS::joinPath($this->jsonFilesDirectory, 'expected_templatesnippet_content.json'))); // ACT $contentUpdaterService->updateDefaultFormValuesOfTemplateSnippet($websiteId, $templateSnippetId); // ASSERT $templateSnippet = $templateSnippetService->getById($websiteId, $templateSnippetId); $actualContent = json_decode($templateSnippet->getContent()); $this->assertEquals($expectedContent, $actualContent); }
/** * @test * @group small * @group dev * @group library */ public function test_updateDefaultFormValuesOfTemplate_success() { // ARRANGE $websiteId = 'SITE-update00-defa-ult0-form-values000001-SITE'; $templateId = 'TPL-update00-defa-ult0-form-values000001-TPL'; $orgTemplateContentChecksum = 'theoriginaltemplatechecksum'; $contentUpdaterService = new ContentUpdaterService('ContentUpdater'); $templateService = new TemplateService('Template'); $expectedContentJson = FS::readContentFromFile(FS::joinPath($this->jsonFilesDirectory, 'expected_template_content.json')); $expectedContent = json_decode($expectedContentJson); // ACT $contentUpdaterService->updateDefaultFormValuesOfTemplate($websiteId, $templateId); // ASSERT $template = $templateService->getById($templateId, $websiteId); $this->assertNotSame($orgTemplateContentChecksum, $template->getContentchecksum()); $templateContent = json_decode($template->getContent()); $this->assertEquals($expectedContent, $templateContent); }