From 97a4d3fc97ab9f8cc58ab693989fbec2b152998c Mon Sep 17 00:00:00 2001
From: Jean-Michel Vedrine <vedrine@vedrine.org>
Date: Mon, 1 Jan 2018 23:18:32 +0100
Subject: Improve test helper

---
 tests/helper.php            | 9 ++++++---
 tests/questiontype_test.php | 4 ++--
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/tests/helper.php b/tests/helper.php
index e36ed9c..d569db2 100644
--- a/tests/helper.php
+++ b/tests/helper.php
@@ -55,6 +55,7 @@ class qtype_algebra_test_helper extends question_test_helper {
         $q->answerprefix = '';
         $q->answers = array(
             13 => new question_answer(13, '7*x', 1.0, 'This is a very good answer.', FORMAT_HTML),
+            14 => new question_answer(14, '*', 0.0, 'This is completely wrong.', FORMAT_HTML),
         );
         $q->variables = array(
             7 => new qtype_algebra_variable(7, 'x', -5, 5)
@@ -86,7 +87,8 @@ class qtype_algebra_test_helper extends question_test_helper {
         $qdata->options->allowedfuncs = '';
         $qdata->options->answerprefix = '';
         $qdata->options->answers = array(
-            13 => new question_answer(13, '7', 1.0, 'This is a very good answer.', FORMAT_HTML),
+            13 => new question_answer(13, '7*x', 1.0, 'This is a very good answer.', FORMAT_HTML),
+            14 => new question_answer(14, '*', 0.0, 'This is completely wrong.', FORMAT_HTML),
         );
         $qdata->options->variables = array(
             7 => new qtype_algebra_variable(7, 'x', -5, 5)
@@ -114,13 +116,14 @@ class qtype_algebra_test_helper extends question_test_helper {
         $form->allowedfuncs = '';
         $form->disallow = '';
         $form->answerprefix = '';
-        $form->answer = array('7*x');
-        $form->fraction = array('1.0');
+        $form->answer = array('7*x', '*');
+        $form->fraction = array('1.0', '0.0');
         $form->variable = array('x');
         $form->varmin = array('-5');
         $form->varmax = array('5');
         $form->feedback = array(
             array('text' => 'This is a very good answer.', 'format' => FORMAT_HTML),
+            array('text' => 'This is completely wrong.', 'format' => FORMAT_HTML),
         );
 
         return $form;
diff --git a/tests/questiontype_test.php b/tests/questiontype_test.php
index 929b074..07ab4c3 100644
--- a/tests/questiontype_test.php
+++ b/tests/questiontype_test.php
@@ -58,7 +58,7 @@ class qtype_algebra_test extends advanced_testcase {
     }
 
     public function test_name() {
-        $this->assertEquals($this->qtype->name(), 'algebra', 'simplemath');
+        $this->assertEquals($this->qtype->name(), 'algebra');
     }
 
     public function test_can_analyse_responses() {
@@ -66,7 +66,7 @@ class qtype_algebra_test extends advanced_testcase {
     }
 
     public function test_get_random_guess_score() {
-        $q = test_question_maker::get_question_data('algebra', 'simplemath');
+        $q = test_question_maker::get_question_data('algebra');
         $q->options->answers[15]->fraction = 0.1;
         $this->assertEquals(0.1, $this->qtype->get_random_guess_score($q));
     }
-- 
cgit v1.2.3