/** * Test getSessionID returns NULL for none existing visit * * @covers Candidate::getSessionID * @return void */ public function testGetSessionIDReturnsNullForNoneExistingVisit() { $this->_setUpTestDoublesForSelectCandidate(); $this->_candidate->select(969664); $this->assertNull($this->_candidate->getSessionID(0)); }
//define the command line parameters if (count($argv) != 3) { echo "Usage: php delete_candidate DCCID PSCID\n"; echo "Example: php delete_candidate 608858 SEA0252\n"; die; } else { $DCCID = $argv[1]; $PSCID = $argv[2]; } if ($DB->pselectOne("SELECT COUNT(*) FROM candidate WHERE CandID = :cid AND PSCID = :pid ", array('cid' => $DCCID, 'pid' => $PSCID)) == 0) { echo "The Candid : {$DCCID} AND PSCID : {$PSCID} Doesn't Exist in " . "the database\n"; die; } //Find candidate... $candidate = new Candidate(); $candidate->select($DCCID); //find the candidate with the given DCCID //find sessions $sessions = $candidate->getListOfTimePoints(); if (is_null($sessions) || empty($sessions)) { echo "There are no coressponding session for Candid : {$DCCID} \n"; die; } echo "Dropping all DB entries for candidate DCCID: " . $DCCID . "And PSCID:" . $PSCID . "\n"; //find the test_names and commentIDs $query = "SELECT ID, Test_name, CommentID FROM flag WHERE SessionID in (" . implode(" , ", $sessions) . ")"; $instruments = $DB->pselect($query, array()); //delete the sessions $DB->delete("session", array("CandID" => $DCCID)); //delete each instrument table entry foreach ($instruments as $instrument) {