public function testChangelog() { $this->flushDBCache(); $objChanges = new class_module_system_changelog(); $strSystemid = generateSystemid(); $arrOldValues = $objChanges->readOldValues(new dummyObject($strSystemid)); $this->assertEquals($arrOldValues["strTest"], "old"); $this->assertEquals($arrOldValues["strSecondTest"], "second old"); $arrOldValues = $objChanges->getOldValuesForSystemid($strSystemid); $this->assertEquals($arrOldValues["strTest"], "old"); $this->assertEquals($arrOldValues["strSecondTest"], "second old"); $objChanges->createLogEntry(new dummyObject($strSystemid), "1"); $objChanges->processCachedInserts(); $this->assertEquals(0, class_module_system_changelog::getLogEntriesCount($strSystemid)); class_carrier::getInstance()->getObjDB()->flushQueryCache(); $objDummy = new dummyObject($strSystemid); $objDummy->setStrTest("new test 1"); $objDummy->setStrSecondTest("new val 2"); $objChanges->createLogEntry($objDummy, "2"); $objChanges->processCachedInserts(); $this->assertEquals(2, class_module_system_changelog::getLogEntriesCount($strSystemid)); $this->assertEquals(2, count(class_module_system_changelog::getLogEntries($strSystemid))); $arrLogs = class_module_system_changelog::getLogEntries($strSystemid); foreach ($arrLogs as $objOneChangelog) { if ($objOneChangelog->getStrProperty() == "strTest") { $this->assertEquals($objOneChangelog->getStrOldValue(), "old"); $this->assertEquals($objOneChangelog->getStrNewValue(), "new test 1"); } if ($objOneChangelog->getStrProperty() == "strSecondTest") { $this->assertEquals($objOneChangelog->getStrOldValue(), "second old"); $this->assertEquals($objOneChangelog->getStrNewValue(), "new val 2"); } } class_carrier::getInstance()->getObjDB()->flushQueryCache(); $objChanges->createLogEntry(new dummyObject($strSystemid), "2", true); $objChanges->processCachedInserts(); $this->assertEquals(4, class_module_system_changelog::getLogEntriesCount($strSystemid)); $this->assertEquals(4, count(class_module_system_changelog::getLogEntries($strSystemid))); }