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';
101 $this->assertEquals(
false, $obj->isComplete());
102 $obj->setTitle(
'Tilte');
103 $obj->setAuthor(
'Me or another');
104 $obj->setQuestion(
'My great Question.');
105 $obj->addAnswer(
'Super simple single Choice', 1);
107 $this->assertEquals(
true, $obj->isComplete());
113 $this->assertEquals(
'thumb.', $obj->getThumbPrefix());
119 $obj->setOutputType(0);
120 $this->assertEquals(0, $obj->getOutputType());
125 $this->assertEquals(0, $obj->getAnswerCount());
126 $obj->addAnswer(
'Points for checked', 1, 0, 0);
127 $obj->addAnswer(
'Points for unchecked', 0, 1, 1);
128 $this->assertEquals(2, $obj->getAnswerCount());
129 $obj->deleteAnswer(0);
130 $this->assertEquals(1, $obj->getAnswerCount());
136 $obj->addAnswer(
'1', 1, 0, 0);
137 $obj->addAnswer(
'1', 1, 0, 1);
138 $this->assertEquals(2, $obj->getAnswerCount());
139 $obj->flushAnswers();
140 $this->assertEquals(0, $obj->getAnswerCount());
146 $this->assertEquals(
'assMultipleChoice', $obj->getQuestionType());
152 $this->assertEquals(
'qpl_qst_mc', $obj->getAdditionalTableName());
158 $this->assertEquals(
'qpl_a_mc', $obj->getAnswerTableName());
164 $obj->addAnswer(
'Points for checked', 1, 0, 0);
165 $obj->addAnswer(
'Points for checked', 1, 0, 1);
166 $this->assertEquals(2, $obj->getMaximumPoints());
171 $obj->addAnswer(
'Points for unchecked', 0, 1, 0);
172 $obj->addAnswer(
'Points for unchecked', 0, 1, 1);
173 $this->assertEquals(2, $obj->getMaximumPoints());
178 $obj->addAnswer(
'Points for unchecked', 0, 1, 0);
179 $obj->addAnswer(
'Points for unchecked', 0, 1, 1);
180 $this->assertEquals(2, $obj->getMaximumPoints());
181 $obj->addAnswer(
'Points for checked', 1, 0, 2);
182 $obj->addAnswer(
'Points for checked', 1, 0, 3);
183 $this->assertEquals(4, $obj->getMaximumPoints());
184 $obj->addAnswer(
'Points for checked', 1, 1, 4);
185 $obj->addAnswer(
'Points for checked', 1, 1, 5);
186 $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()
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
test_getMaximumPointsMixed_shouldReturnAnswerTableName()