/** * @test * @group library */ public function updateContentShouldUpdateUsedModuleIds() { // // ARRANGE // $templateId = 'TPL-eb0c38ed-1603-48ee-a8b8-a1c93c06e763-TPL'; $websiteId = 'SITE-56c01626-da62-4446-a79a-22b5cb86955f-SITE'; $newAttributes = array('content' => '[{"test":"entry","moduleId":"usedmoduleid1","children":[{"moduleId":"usedmoduleid2"}]}]'); $expectedUsedModuleIdsAfterUpdate = array('usedmoduleid1', 'usedmoduleid2'); sort($expectedUsedModuleIdsAfterUpdate); $template = $this->dao->getById($templateId, $websiteId); $contentBeforUpdate = $template->getContent(); $usedModuleIdsBeforUpdate = $template->getUsedmoduleids(); $this->assertNotSame($contentBeforUpdate, $newAttributes['content']); // // ACT // $template = $this->dao->update($templateId, $websiteId, $newAttributes); $usedModuleIdsAfterUpdate = $template->getUsedmoduleids(); sort($usedModuleIdsAfterUpdate); // // ASSERT // $this->assertNotEquals($usedModuleIdsBeforUpdate, $usedModuleIdsAfterUpdate); $this->assertInternalType('array', $usedModuleIdsAfterUpdate); $this->assertEquals(2, count($usedModuleIdsAfterUpdate)); $this->assertEquals($expectedUsedModuleIdsAfterUpdate, $usedModuleIdsAfterUpdate); }
/** * @test * @group library */ public function createShouldCreateChecksumAsExpected() { // // ARRANGE // $websiteId = 'SITE-56c01626-da62-4446-a79a-22b5cb86955f-SITE'; $newAttributes = array('name' => 'Dao\\Template\\CreateTest\\createShouldUpdateUsedModuleIds', 'content' => '[{"test":"entry","moduleId":"usedmoduleid1","children":[{"moduleId":"usedmoduleid2"}]}]'); $expectedContentChecksum = md5($newAttributes['content']); // // ACT // $template = $this->dao->create($websiteId, $newAttributes); // // ASSERT // $this->assertSame($expectedContentChecksum, $template->getContentchecksum()); }