]> git.mjollnir.org Git - moodle.git/commitdiff
Another unit test.
authortjhunt <tjhunt>
Tue, 1 Jul 2008 10:54:55 +0000 (10:54 +0000)
committertjhunt <tjhunt>
Tue, 1 Jul 2008 10:54:55 +0000 (10:54 +0000)
question/type/shortanswer/simpletest/testquestiontype.php

index 571b9ec0a6754406f6f8723b6ff5819b65a1f4e0..00cffdc99fb64b9b117ba3fd7aca945e1898e6e6 100644 (file)
@@ -68,6 +68,21 @@ class question_shortanswer_qtype_test extends UnitTestCase {
         $this->assertTrue($this->qtype->compare_string_with_wildcard('\{}/', '\{}/', true));
     }
 
+    function test_test_response() {
+        $answer = new stdClass;
+        $answer->id = 1;
+        $answer->answer = 'entrance';
+        $answer->fraction = 1;
+        $question = new stdClass;
+        $question->options->answers = array(
+            1 => $answer,
+        );
+        $question->options->usecase = 0;
+        $state = new stdClass;
+        $state->responses[''] = 'Entrance';
+        $this->assertTrue($this->qtype->test_response($question, $state, $answer));
+    }
+
     function test_get_correct_responses() {
         $answer1 = new stdClass;
         $answer1->id = 17;