query("DELETE FROM upgrade_history WHERE name = 'SugarEnt-Upgrade-6.3.x-to-6.4.3'"); $this->new_upgrade = new UpgradeHistory(); $this->new_upgrade->filename = 'cache/upload/upgrade/temp/Bug51721Test.zip'; $this->new_upgrade->md5sum = md5('cache/upload/upgrade/temp/Bug51721Test.zip'); $this->new_upgrade->type = 'patch'; $this->new_upgrade->version = '6.4.3'; $this->new_upgrade->status = "installed"; $this->new_upgrade->name = 'SugarEnt-Upgrade-6.3.x-to-6.4.3'; $this->new_upgrade->description = 'Silent Upgrade was used to upgrade the instance'; $this->new_upgrade->save(); $this->new_upgrade2 = new UpgradeHistory(); $this->new_upgrade2->filename = 'cache//upload/upgrade/temp/Bug51721Test.zip'; $this->new_upgrade2->md5sum = md5('cache//upload/upgrade/temp/Bug51721Test.zip'); $this->new_upgrade2->type = 'patch'; $this->new_upgrade2->version = '6.4.3'; $this->new_upgrade2->status = "installed"; $this->new_upgrade2->name = 'SugarEnt-Upgrade-6.3.x-to-6.4.3'; $this->new_upgrade2->description = 'Silent Upgrade was used to upgrade the instance'; $this->new_upgrade2->save(); } public function tearDown() { $GLOBALS['db']->query("DELETE FROM upgrade_history WHERE id IN ('{$this->new_upgrade->id}', '{$this->new_upgrade2->id}')"); } public function testRepairUpgradeHistoryTable() { repairUpgradeHistoryTable(); $file = $GLOBALS['db']->getOne("SELECT filename FROM upgrade_history WHERE id = '{$this->new_upgrade->id}'"); $this->assertEquals('upload/upgrade/temp/Bug51721Test.zip', $file); $file = $GLOBALS['db']->getOne("SELECT filename FROM upgrade_history WHERE id = '{$this->new_upgrade2->id}'"); $this->assertEquals('upload/upgrade/temp/Bug51721Test.zip', $file); } }