Added new files for exercises (problems with call method and objects) CT#191

skala
Arthur Portugal 15 years ago
parent 9a08d8cf16
commit a331bf5f7c
  1. 42
      tests/main/exercice/exercise.lib.test.php
  2. 45
      tests/main/exercice/fill_blanks.class.test.php
  3. 29
      tests/main/exercice/freeanswer.class.test.php

@ -0,0 +1,42 @@
<?php
require_once api_get_path(SYS_CODE_PATH).'exercice/question.class.php';
class TestExerciseLib extends UnitTestCase {
/*public $eQuestion;
public function TestExerciseLib() {
$this->UnitTestCase('');
}
public function setUp() {
$this->eQuestion = new Question();
}
public function tearDown() {
$this->eQuestion = null;
}*/
/**
* @param int question id
* @param boolean only answers
* @param boolean origin i.e = learnpath
* @param int current item from the list of questions
* @param int number of total questions
*/
function testshowQuestion() {
global $_course;
$questionId = 1;
$current_item = 1 ;
$total_item = 1;
//$objQuestionTmp = $question->read($questionId);
$res = showQuestion($questionId, $onlyAnswers=false, $origin=false,$current_item, $total_item);
$this->assertTrue(is_null($res));
var_dump($res);
}
}
?>

@ -0,0 +1,45 @@
<?php
class TestFillBlanksClass extends UnitTestCase {
public $fFillBlanks;
public function TestFillBlanksClass() {
$this->UnitTestCase('');
}
public function setUp() {
$this->fFillBlanks = new FillBlanks();
}
public function tearDown() {
$this->fFillBlanks = null;
}
/**
* function which redifines Question::createAnswersForm
* @param the formvalidator instance
*/
/*
function testcreateAnswersForm() {
$form = new FormValidator('introduction_text');
$res = $this->fFillBlanks->createAnswersForm($form);
$this->assertTrue(is_null($res));
var_dump($res);
}*/
/**
* abstract function which creates the form to create / edit the answers of the question
* @param the formvalidator instance
*/
/*
function testprocessAnswersCreation() {
global $charset;
$form = new FormValidator('introduction_text');
$res = $this->fFillBlanks->processAnswersCreation($form);
$this->assertTrue(is_null($res));
var_dump($res);
}*/
}
?>

@ -0,0 +1,29 @@
<?php
class TestFreeanswer extends UnitTestCase {
/**
* function which redifines Question::createAnswersForm
* @param the formvalidator instance
*/
function testcreateAnswersForm () {
$form = new FormValidator('exercise_admin', 'post', api_get_self().'?exerciseId='.$_GET['exerciseId']);
$res =FreeAnswer::createAnswersForm($form);
$this->assertTrue(is_null($res));
//var_dump($res);
}
/**
* abstract function which creates the form to create / edit the answers of the question
* @param the formvalidator instance
*/
function testprocessAnswersCreation () {
$form = new FormValidator('exercise_admin', 'post', api_get_self().'?exerciseId='.$_GET['exerciseId']);
$res =FreeAnswer::processAnswersCreation($form);
$this->assertTrue(is_null($res));
//var_dump($res);
}
}
?>
Loading…
Cancel
Save