From a331bf5f7c283d1564d0513b23547bc7c2c270f6 Mon Sep 17 00:00:00 2001 From: Arthur Portugal Date: Wed, 17 Feb 2010 09:42:20 -0500 Subject: [PATCH] Added new files for exercises (problems with call method and objects) CT#191 --- tests/main/exercice/exercise.lib.test.php | 42 +++++++++++++++++ .../main/exercice/fill_blanks.class.test.php | 45 +++++++++++++++++++ tests/main/exercice/freeanswer.class.test.php | 29 ++++++++++++ 3 files changed, 116 insertions(+) create mode 100644 tests/main/exercice/exercise.lib.test.php create mode 100644 tests/main/exercice/fill_blanks.class.test.php create mode 100644 tests/main/exercice/freeanswer.class.test.php diff --git a/tests/main/exercice/exercise.lib.test.php b/tests/main/exercice/exercise.lib.test.php new file mode 100644 index 0000000000..769fde0cb7 --- /dev/null +++ b/tests/main/exercice/exercise.lib.test.php @@ -0,0 +1,42 @@ +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); + } + + + + +} +?> diff --git a/tests/main/exercice/fill_blanks.class.test.php b/tests/main/exercice/fill_blanks.class.test.php new file mode 100644 index 0000000000..055e1072e5 --- /dev/null +++ b/tests/main/exercice/fill_blanks.class.test.php @@ -0,0 +1,45 @@ +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); + }*/ + +} +?> diff --git a/tests/main/exercice/freeanswer.class.test.php b/tests/main/exercice/freeanswer.class.test.php new file mode 100644 index 0000000000..8b94afc0e0 --- /dev/null +++ b/tests/main/exercice/freeanswer.class.test.php @@ -0,0 +1,29 @@ +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); + } + +} +?>