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';
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());
114 $this->assertEquals(
'thumb.', $obj->getThumbPrefix());
120 $obj->setOutputType(0);
121 $this->assertEquals(0, $obj->getOutputType());
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());
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());
147 $this->assertEquals(
'assMultipleChoice', $obj->getQuestionType());
153 $this->assertEquals(
'qpl_qst_mc', $obj->getAdditionalTableName());
159 $this->assertEquals(
'qpl_a_mc', $obj->getAnswerTableName());
165 $obj->addAnswer(
'Points for checked', 1, 0, 0);
166 $obj->addAnswer(
'Points for checked', 1, 0, 1);
167 $this->assertEquals(2, $obj->getMaximumPoints());
172 $obj->addAnswer(
'Points for unchecked', 0, 1, 0);
173 $obj->addAnswer(
'Points for unchecked', 0, 1, 1);
174 $this->assertEquals(2, $obj->getMaximumPoints());
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());
test_getAnswerCount_shouldReturnCount()
test_getAdditionalTableName_shouldReturnAdditionalTableName()
test_getQuestionType_shouldReturnQuestionType()
test_getThumbPrefix_shouldReturnString()
test_isComplete_shouldReturnTrue()
Create a sample question and save it to the database.
Class for multiple choice tests.
test_flushAnswers_shouldClearAnswers()
Unit tests for single choice questions.
test_setOutputType_shouldReturngetOutputType()
test_getMaximumPoints_shouldReturnAnswerTableName()
test_getMaximumPointsIfMoreForUnchecked_shouldReturnAnswerTableName()
test_getAnswerTableName_shouldReturnAnswerTableName()
test_getMaximumPointsMixed_shouldReturnAnswerTableName()