retrieve('1'); } public function tearDown() { unset($GLOBALS['module']); unset($GLOBALS['action']); unset($GLOBALS['mod_strings']); unset($GLOBALS['current_user']); unset($_REQUEST); $GLOBALS['db']->query("DELETE FROM notes WHERE id IN ('".$this->note1->id."','".$this->note2->id."')"); // Just in case there is a custom table here if($GLOBALS['db']->tableExists('notes_cstm')) { $GLOBALS['db']->query("DELETE FROM notes_cstm WHERE id_c IN ('".$this->note1->id."','".$this->note2->id."')"); } parent::tearDown(); } public function testRepairXSSNotDuplicating() { $this->note1 = new Note(); $this->note1->id = create_guid(); $this->note1->new_with_id = true; $this->note1->name = "[Bug47069] Not deleted Note"; $this->note1->description = "This note shouldn't be deleted."; $this->note1->save(); $this->note2 = new Note(); $this->note2->id = create_guid(); $this->note2->new_with_id = true; $this->note2->name = "[Bug47069] Deleted Note"; $this->note2->description = "This note should be deleted."; $this->note2->deleted = 1; $this->note2->save(); ob_start(); $_REQUEST['adminAction'] = 'refreshEstimate'; $_REQUEST['bean'] = 'Notes'; require_once('modules/Administration/Async.php'); $firstEstimate = $out; ob_end_clean(); ob_start(); $_REQUEST['adminAction'] = 'repairXssExecute'; $_REQUEST['bean'] = 'Notes'; $_REQUEST['id'] = json_encode(array($this->note1->id,$this->note2->id)); require_once('modules/Administration/Async.php'); ob_end_clean(); ob_start(); $_REQUEST['adminAction'] = 'refreshEstimate'; $_REQUEST['bean'] = 'Notes'; require_once('modules/Administration/Async.php'); $secondEstimate = $out; ob_end_clean(); $this->assertEquals($firstEstimate['count'],$secondEstimate['count'], 'The record count should not increase after a repair XSS'); } }