Unit tests for single choice questions.
More...
Unit tests for single choice questions.
- Author
- Helmut Schottmüller ilias.nosp@m.@aur.nosp@m.ealis.nosp@m..de
- Version
- $Id$
Definition at line 13 of file assMultipleChoiceTest.php.
◆ setUp()
assMultipleChoiceTest::setUp |
( |
| ) |
|
|
protected |
Definition at line 17 of file assMultipleChoiceTest.php.
19 require_once
'./Modules/TestQuestionPool/classes/class.assMultipleChoice.php';
20 if (defined(
'ILIAS_PHPUNIT_CONTEXT')) {
21 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
22 ilUnitUtil::performInitialisation();
24 chdir(dirname(__FILE__));
27 require_once
'./Services/Utilities/classes/class.ilUtil.php';
◆ test_flushAnswers_shouldClearAnswers()
assMultipleChoiceTest::test_flushAnswers_shouldClearAnswers |
( |
| ) |
|
Definition at line 134 of file assMultipleChoiceTest.php.
137 $obj->addAnswer(
'1', 1, 0, 0);
138 $obj->addAnswer(
'1', 1, 0, 1);
139 $this->assertEquals(2, $obj->getAnswerCount());
140 $obj->flushAnswers();
141 $this->assertEquals(0, $obj->getAnswerCount());
Class for multiple choice tests.
◆ test_getAdditionalTableName_shouldReturnAdditionalTableName()
assMultipleChoiceTest::test_getAdditionalTableName_shouldReturnAdditionalTableName |
( |
| ) |
|
Definition at line 150 of file assMultipleChoiceTest.php.
153 $this->assertEquals(
'qpl_qst_mc', $obj->getAdditionalTableName());
Class for multiple choice tests.
◆ test_getAnswerCount_shouldReturnCount()
assMultipleChoiceTest::test_getAnswerCount_shouldReturnCount |
( |
| ) |
|
Definition at line 123 of file assMultipleChoiceTest.php.
126 $this->assertEquals(0, $obj->getAnswerCount());
127 $obj->addAnswer(
'Points for checked', 1, 0, 0);
128 $obj->addAnswer(
'Points for unchecked', 0, 1, 1);
129 $this->assertEquals(2, $obj->getAnswerCount());
130 $obj->deleteAnswer(0);
131 $this->assertEquals(1, $obj->getAnswerCount());
Class for multiple choice tests.
◆ test_getAnswerTableName_shouldReturnAnswerTableName()
assMultipleChoiceTest::test_getAnswerTableName_shouldReturnAnswerTableName |
( |
| ) |
|
Definition at line 156 of file assMultipleChoiceTest.php.
159 $this->assertEquals(
'qpl_a_mc', $obj->getAnswerTableName());
Class for multiple choice tests.
◆ test_getMaximumPoints_shouldReturnAnswerTableName()
assMultipleChoiceTest::test_getMaximumPoints_shouldReturnAnswerTableName |
( |
| ) |
|
Definition at line 162 of file assMultipleChoiceTest.php.
165 $obj->addAnswer(
'Points for checked', 1, 0, 0);
166 $obj->addAnswer(
'Points for checked', 1, 0, 1);
167 $this->assertEquals(2, $obj->getMaximumPoints());
Class for multiple choice tests.
◆ test_getMaximumPointsIfMoreForUnchecked_shouldReturnAnswerTableName()
assMultipleChoiceTest::test_getMaximumPointsIfMoreForUnchecked_shouldReturnAnswerTableName |
( |
| ) |
|
Definition at line 169 of file assMultipleChoiceTest.php.
172 $obj->addAnswer(
'Points for unchecked', 0, 1, 0);
173 $obj->addAnswer(
'Points for unchecked', 0, 1, 1);
174 $this->assertEquals(2, $obj->getMaximumPoints());
Class for multiple choice tests.
◆ test_getMaximumPointsMixed_shouldReturnAnswerTableName()
assMultipleChoiceTest::test_getMaximumPointsMixed_shouldReturnAnswerTableName |
( |
| ) |
|
Definition at line 176 of file assMultipleChoiceTest.php.
179 $obj->addAnswer(
'Points for unchecked', 0, 1, 0);
180 $obj->addAnswer(
'Points for unchecked', 0, 1, 1);
181 $this->assertEquals(2, $obj->getMaximumPoints());
182 $obj->addAnswer(
'Points for checked', 1, 0, 2);
183 $obj->addAnswer(
'Points for checked', 1, 0, 3);
184 $this->assertEquals(4, $obj->getMaximumPoints());
185 $obj->addAnswer(
'Points for checked', 1, 1, 4);
186 $obj->addAnswer(
'Points for checked', 1, 1, 5);
187 $this->assertEquals(6, $obj->getMaximumPoints());
Class for multiple choice tests.
◆ test_getQuestionType_shouldReturnQuestionType()
assMultipleChoiceTest::test_getQuestionType_shouldReturnQuestionType |
( |
| ) |
|
Definition at line 144 of file assMultipleChoiceTest.php.
147 $this->assertEquals(
'assMultipleChoice', $obj->getQuestionType());
Class for multiple choice tests.
◆ test_getThumbPrefix_shouldReturnString()
assMultipleChoiceTest::test_getThumbPrefix_shouldReturnString |
( |
| ) |
|
Definition at line 111 of file assMultipleChoiceTest.php.
114 $this->assertEquals(
'thumb.', $obj->getThumbPrefix());
Class for multiple choice tests.
◆ test_isComplete_shouldReturnTrue()
assMultipleChoiceTest::test_isComplete_shouldReturnTrue |
( |
| ) |
|
Create a sample question and save it to the database.
- Parameters
-
integer | $obj_id | Object ID of the containing question pool object (optional) |
- Returns
- integer ID of the newly created question Question creation test
- Parameters
-
Definition at line 99 of file assMultipleChoiceTest.php.
102 $this->assertEquals(
false, $obj->isComplete());
103 $obj->setTitle(
'Tilte');
104 $obj->setAuthor(
'Me or another');
105 $obj->setQuestion(
'My great Question.');
106 $obj->addAnswer(
'Super simple single Choice', 1);
108 $this->assertEquals(
true, $obj->isComplete());
Class for multiple choice tests.
◆ test_setOutputType_shouldReturngetOutputType()
assMultipleChoiceTest::test_setOutputType_shouldReturngetOutputType |
( |
| ) |
|
Definition at line 117 of file assMultipleChoiceTest.php.
120 $obj->setOutputType(0);
121 $this->assertEquals(0, $obj->getOutputType());
Class for multiple choice tests.
◆ $backupGlobals
assMultipleChoiceTest::$backupGlobals = false |
|
protected |
The documentation for this class was generated from the following file: