This class creates questions of various types, which can then be used when testing.
More...
|
static | get_a_qa ($question, $maxmark=3) |
| Just make a question_attempt at a question. More...
|
|
static | get_question_data ($qtype, $which=null) |
| Like make_question() but returns the datastructure from get_question_options instead of the question_definition object. More...
|
|
static | get_question_form_data ($qtype, $which=null) |
| Like make_question() but returns the data what would be saved from the question editing form instead of the question_definition object. More...
|
|
static | get_test_helper ($qtype) |
| Get the test helper class for a particular question type. More...
|
|
static | initialise_a_question ($q) |
| Initialise the common fields of a question of any type.
|
|
static | initialise_question_data ($qdata) |
|
static | make_a_matching_question () |
| Makes a matching question to classify 'Dog', 'Frog', 'Toad' and 'Cat' as 'Mammal', 'Amphibian' or 'Insect'. More...
|
|
static | make_a_multichoice_multi_question () |
| Makes a multichoice question with choices 'A', 'B', 'C' and 'D' shuffled. More...
|
|
static | make_a_multichoice_single_question () |
| Makes a multichoice question with choices 'A', 'B' and 'C' shuffled. More...
|
|
static | make_an_essay_question () |
| Makes a truefalse question with correct ansewer true, defaultmark 1. More...
|
|
static | make_question ($qtype, $which=null) |
| Question types can provide a number of test question defintions. More...
|
|
static | set_standard_combined_feedback_fields ($q) |
| Add some standard overall feedback to a question. More...
|
|
static | set_standard_combined_feedback_form_data ($form) |
| Add some standard overall feedback to a question's form data.
|
|
|
const | STANDARD_OVERALL_CORRECT_FEEDBACK = 'Well done!' |
|
const | STANDARD_OVERALL_INCORRECT_FEEDBACK = 'That is not right at all.' |
|
const | STANDARD_OVERALL_PARTIALLYCORRECT_FEEDBACK |
|
|
static array | $testhelpers = array() |
| qtype => qtype test helper class.
|
|
This class creates questions of various types, which can then be used when testing.
- Copyright
- 2009 The Open University
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ call_question_helper_method()
static test_question_maker::call_question_helper_method |
( |
|
$methodtemplate, |
|
|
|
$qtype, |
|
|
|
$which = null |
|
) |
| |
|
staticprotected |
Call a method on a qtype_{$qtype}_test_helper class and return the result.
- Parameters
-
string | $methodtemplate | e.g. 'make_{qtype}_question_{which}'; |
string | $qtype | the question type to get a test question for. |
string | $which | one of the names returned by the get_test_questions method of the relevant qtype_{$qtype}_test_helper class. |
unknown_type | $which | |
◆ get_a_qa()
static test_question_maker::get_a_qa |
( |
|
$question, |
|
|
|
$maxmark = 3 |
|
) |
| |
|
static |
Just make a question_attempt at a question.
Useful for unit tests that need to pass a $qa to methods that call format_text. Probably not safe to use for anything beyond that.
- Parameters
-
- Return values
-
◆ get_question_data()
static test_question_maker::get_question_data |
( |
|
$qtype, |
|
|
|
$which = null |
|
) |
| |
|
static |
Like make_question() but returns the datastructure from get_question_options instead of the question_definition object.
- Parameters
-
string | $qtype | the question type to get a test question for. |
string | $which | one of the names returned by the get_test_questions method of the relevant qtype_{$qtype}_test_helper class. |
- Return values
-
stdClass | the requested question object. |
◆ get_question_form_data()
static test_question_maker::get_question_form_data |
( |
|
$qtype, |
|
|
|
$which = null |
|
) |
| |
|
static |
Like make_question() but returns the data what would be saved from the question editing form instead of the question_definition object.
- Parameters
-
string | $qtype | the question type to get a test question for. |
string | $which | one of the names returned by the get_test_questions method of the relevant qtype_{$qtype}_test_helper class. |
- Return values
-
stdClass | the requested question object. |
◆ get_test_helper()
static test_question_maker::get_test_helper |
( |
|
$qtype | ) |
|
|
static |
Get the test helper class for a particular question type.
- Parameters
-
$qtype | the question type name, e.g. 'multichoice'. |
- Return values
-
◆ make_a_matching_question()
static test_question_maker::make_a_matching_question |
( |
| ) |
|
|
static |
Makes a matching question to classify 'Dog', 'Frog', 'Toad' and 'Cat' as 'Mammal', 'Amphibian' or 'Insect'.
defaultmark 1. Stems are shuffled by default.
- Return values
-
◆ make_a_multichoice_multi_question()
static test_question_maker::make_a_multichoice_multi_question |
( |
| ) |
|
|
static |
Makes a multichoice question with choices 'A', 'B', 'C' and 'D' shuffled.
'A' and 'C' is correct, defaultmark 1.
- Return values
-
◆ make_a_multichoice_single_question()
static test_question_maker::make_a_multichoice_single_question |
( |
| ) |
|
|
static |
Makes a multichoice question with choices 'A', 'B' and 'C' shuffled.
'A' is correct, defaultmark 1.
- Return values
-
◆ make_an_essay_question()
static test_question_maker::make_an_essay_question |
( |
| ) |
|
|
static |
Makes a truefalse question with correct ansewer true, defaultmark 1.
- Return values
-
◆ make_question()
static test_question_maker::make_question |
( |
|
$qtype, |
|
|
|
$which = null |
|
) |
| |
|
static |
Question types can provide a number of test question defintions.
They do this by creating a qtype_{$qtype}_test_helper class that extends question_test_helper. The get_test_questions method returns the list of test questions available for this question type.
- Parameters
-
string | $qtype | the question type to get a test question for. |
string | $which | one of the names returned by the get_test_questions method of the relevant qtype_{$qtype}_test_helper class. |
- Return values
-
◆ set_standard_combined_feedback_fields()
static test_question_maker::set_standard_combined_feedback_fields |
( |
|
$q | ) |
|
|
static |
Add some standard overall feedback to a question.
You need to use these specific feedback strings for the corresponding contains_..._feedback methods in qbehaviour_walkthrough_test_base to works.
- Parameters
-
◆ STANDARD_OVERALL_PARTIALLYCORRECT_FEEDBACK
const test_question_maker::STANDARD_OVERALL_PARTIALLYCORRECT_FEEDBACK |
Initial value:=
'Parts, but only parts, of your response are correct.'
The documentation for this class was generated from the following file: