示例#1
0
 function clearAll()
 {
     $this->clearMysqlLog();
     My_Logger::clearLog();
     $this->db->query("SET FOREIGN_KEY_CHECKS=0;");
     $tables = array(100 => 'concepts', 123 => 'question_base', 333 => 'question_concepts', 31 => 'quiz', 480 => 'concepts_tested', 1021 => 'quiz_attempt', 2081 => 'generated_questions', 3225 => 'question_attempt', 520 => 'sequence', 'sq' => 'sequence_quiz');
     foreach ($tables as $inc => $table) {
         $this->db->query("TRUNCATE TABLE {$table};");
         if (is_numeric($inc)) {
             $this->db->query("ALTER TABLE {$table} AUTO_INCREMENT = {$inc};");
         }
     }
 }
示例#2
0
 /**
  * @expectedException EvalException 
  */
 function testEvalError()
 {
     $this->clearAll();
     $this->clearTemp();
     $filename = 'evalerror.xml';
     $filepath = $this->config->xml->import_path . "/" . $filename;
     $xml = simplexml_load_file($filepath);
     $concept = (string) $xml->concepts->concept;
     //from source
     $importer = $this->createXmlImporter($this->path);
     $importer->parseFile($filename);
     //Create the quiz
     $qz = $this->createQuiz("Some Quiz", 'comp115-students');
     //Add tested concept to quiz
     $this->addTestedConcept($qz, $concept, 3);
     My_Logger::clearLog();
     $this->clearMysqlLog();
     My_Logger::log('**** BEGIN ******');
     // Get the Question XML
     $mQuestion = new Model_Shell_GenericQuestion($filepath);
     $this->assertEquals('output', $mQuestion->getFriendlyType());
     $this->assertTrue(in_array($concept, $mQuestion->getConcepts()));
     $this->assertEquals('1', $mQuestion->getDifficulty());
     //Here comes the compilation. After this single call, all the artifacts are produced
     //ini_set("display_errors", 0);
     $this->assertEquals(trim((string) $xml->instructions), $mQuestion->getInstructions());
     //ini_set("display_errors", 0);
 }