name = 'abc'; $patchToCheck->id = ''; $GLOBALS['db']->query("INSERT INTO upgrade_history (id, name, date_entered) VALUES ('444', 'abc','2008-12-20 08:08:20') "); $GLOBALS['db']->query("INSERT INTO upgrade_history (id, name , date_entered) VALUES ('555','abc', '2008-12-20 08:08:20')"); $uh = new UpgradeHistory(); $return = $uh->checkForExisting($patchToCheck); $this->assertContains($return->id, array('444','555')); $patchToCheck->id = '555'; $return = $uh->checkForExisting($patchToCheck); $this->assertEquals($return->id, '444'); $GLOBALS['db']->query("delete from upgrade_history where id='444'"); $GLOBALS['db']->query("delete from upgrade_history where id='555'"); } }