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.
References defined.
19 require_once
'./Modules/TestQuestionPool/classes/class.assMultipleChoice.php';
20 if (
defined(
'ILIAS_PHPUNIT_CONTEXT'))
22 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
23 ilUnitUtil::performInitialisation();
27 chdir( dirname( __FILE__ ) );
30 require_once
'./Services/Utilities/classes/class.ilUtil.php';
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
◆ test_flushAnswers_shouldClearAnswers()
assMultipleChoiceTest::test_flushAnswers_shouldClearAnswers |
( |
| ) |
|
Definition at line 136 of file assMultipleChoiceTest.php.
139 $obj->addAnswer(
'1', 1, 0, 0);
140 $obj->addAnswer(
'1', 1, 0, 1);
141 $this->assertEquals(2, $obj->getAnswerCount());
142 $obj->flushAnswers();
143 $this->assertEquals(0, $obj->getAnswerCount());
Class for multiple choice tests.
◆ test_getAdditionalTableName_shouldReturnAdditionalTableName()
assMultipleChoiceTest::test_getAdditionalTableName_shouldReturnAdditionalTableName |
( |
| ) |
|
Definition at line 152 of file assMultipleChoiceTest.php.
155 $this->assertEquals(
'qpl_qst_mc', $obj->getAdditionalTableName());
Class for multiple choice tests.
◆ test_getAnswerCount_shouldReturnCount()
assMultipleChoiceTest::test_getAnswerCount_shouldReturnCount |
( |
| ) |
|
Definition at line 125 of file assMultipleChoiceTest.php.
128 $this->assertEquals(0, $obj->getAnswerCount());
129 $obj->addAnswer(
'Points for checked', 1, 0, 0);
130 $obj->addAnswer(
'Points for unchecked', 0, 1, 1);
131 $this->assertEquals(2, $obj->getAnswerCount());
132 $obj->deleteAnswer(0);
133 $this->assertEquals(1, $obj->getAnswerCount());
Class for multiple choice tests.
◆ test_getAnswerTableName_shouldReturnAnswerTableName()
assMultipleChoiceTest::test_getAnswerTableName_shouldReturnAnswerTableName |
( |
| ) |
|
Definition at line 158 of file assMultipleChoiceTest.php.
161 $this->assertEquals(
'qpl_a_mc', $obj->getAnswerTableName());
Class for multiple choice tests.
◆ test_getMaximumPoints_shouldReturnAnswerTableName()
assMultipleChoiceTest::test_getMaximumPoints_shouldReturnAnswerTableName |
( |
| ) |
|
Definition at line 164 of file assMultipleChoiceTest.php.
167 $obj->addAnswer(
'Points for checked', 1, 0, 0);
168 $obj->addAnswer(
'Points for checked', 1, 0, 1);
169 $this->assertEquals(2, $obj->getMaximumPoints());
Class for multiple choice tests.
◆ test_getMaximumPointsIfMoreForUnchecked_shouldReturnAnswerTableName()
assMultipleChoiceTest::test_getMaximumPointsIfMoreForUnchecked_shouldReturnAnswerTableName |
( |
| ) |
|
Definition at line 171 of file assMultipleChoiceTest.php.
174 $obj->addAnswer(
'Points for unchecked', 0, 1, 0);
175 $obj->addAnswer(
'Points for unchecked', 0, 1, 1);
176 $this->assertEquals(2, $obj->getMaximumPoints());
Class for multiple choice tests.
◆ test_getMaximumPointsMixed_shouldReturnAnswerTableName()
assMultipleChoiceTest::test_getMaximumPointsMixed_shouldReturnAnswerTableName |
( |
| ) |
|
Definition at line 178 of file assMultipleChoiceTest.php.
181 $obj->addAnswer(
'Points for unchecked', 0, 1, 0);
182 $obj->addAnswer(
'Points for unchecked', 0, 1, 1);
183 $this->assertEquals(2, $obj->getMaximumPoints());
184 $obj->addAnswer(
'Points for checked', 1, 0, 2);
185 $obj->addAnswer(
'Points for checked', 1, 0, 3);
186 $this->assertEquals(4, $obj->getMaximumPoints());
187 $obj->addAnswer(
'Points for checked', 1, 1, 4);
188 $obj->addAnswer(
'Points for checked', 1, 1, 5);
189 $this->assertEquals(6, $obj->getMaximumPoints());
Class for multiple choice tests.
◆ test_getQuestionType_shouldReturnQuestionType()
assMultipleChoiceTest::test_getQuestionType_shouldReturnQuestionType |
( |
| ) |
|
Definition at line 146 of file assMultipleChoiceTest.php.
149 $this->assertEquals(
'assMultipleChoice', $obj->getQuestionType());
Class for multiple choice tests.
◆ test_getThumbPrefix_shouldReturnString()
assMultipleChoiceTest::test_getThumbPrefix_shouldReturnString |
( |
| ) |
|
Definition at line 113 of file assMultipleChoiceTest.php.
116 $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 101 of file assMultipleChoiceTest.php.
104 $this->assertEquals(
false, $obj->isComplete());
105 $obj->setTitle(
'Tilte');
106 $obj->setAuthor(
'Me or another');
107 $obj->setQuestion(
'My great Question.');
108 $obj->addAnswer(
'Super simple single Choice', 1);
110 $this->assertEquals(
true, $obj->isComplete());
Class for multiple choice tests.
◆ test_setOutputType_shouldReturngetOutputType()
assMultipleChoiceTest::test_setOutputType_shouldReturngetOutputType |
( |
| ) |
|
Definition at line 119 of file assMultipleChoiceTest.php.
122 $obj->setOutputType(0);
123 $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: