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')) {
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';
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
◆ test_flushAnswers_shouldClearAnswers()
assMultipleChoiceTest::test_flushAnswers_shouldClearAnswers |
( |
| ) |
|
Definition at line 133 of file assMultipleChoiceTest.php.
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());
Class for multiple choice tests.
◆ test_getAdditionalTableName_shouldReturnAdditionalTableName()
assMultipleChoiceTest::test_getAdditionalTableName_shouldReturnAdditionalTableName |
( |
| ) |
|
Definition at line 149 of file assMultipleChoiceTest.php.
152 $this->assertEquals(
'qpl_qst_mc', $obj->getAdditionalTableName());
Class for multiple choice tests.
◆ test_getAnswerCount_shouldReturnCount()
assMultipleChoiceTest::test_getAnswerCount_shouldReturnCount |
( |
| ) |
|
Definition at line 122 of file assMultipleChoiceTest.php.
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());
Class for multiple choice tests.
◆ test_getAnswerTableName_shouldReturnAnswerTableName()
assMultipleChoiceTest::test_getAnswerTableName_shouldReturnAnswerTableName |
( |
| ) |
|
Definition at line 155 of file assMultipleChoiceTest.php.
158 $this->assertEquals(
'qpl_a_mc', $obj->getAnswerTableName());
Class for multiple choice tests.
◆ test_getMaximumPoints_shouldReturnAnswerTableName()
assMultipleChoiceTest::test_getMaximumPoints_shouldReturnAnswerTableName |
( |
| ) |
|
Definition at line 161 of file assMultipleChoiceTest.php.
164 $obj->addAnswer(
'Points for checked', 1, 0, 0);
165 $obj->addAnswer(
'Points for checked', 1, 0, 1);
166 $this->assertEquals(2, $obj->getMaximumPoints());
Class for multiple choice tests.
◆ test_getMaximumPointsIfMoreForUnchecked_shouldReturnAnswerTableName()
assMultipleChoiceTest::test_getMaximumPointsIfMoreForUnchecked_shouldReturnAnswerTableName |
( |
| ) |
|
Definition at line 168 of file assMultipleChoiceTest.php.
171 $obj->addAnswer(
'Points for unchecked', 0, 1, 0);
172 $obj->addAnswer(
'Points for unchecked', 0, 1, 1);
173 $this->assertEquals(2, $obj->getMaximumPoints());
Class for multiple choice tests.
◆ test_getMaximumPointsMixed_shouldReturnAnswerTableName()
assMultipleChoiceTest::test_getMaximumPointsMixed_shouldReturnAnswerTableName |
( |
| ) |
|
Definition at line 175 of file assMultipleChoiceTest.php.
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());
Class for multiple choice tests.
◆ test_getQuestionType_shouldReturnQuestionType()
assMultipleChoiceTest::test_getQuestionType_shouldReturnQuestionType |
( |
| ) |
|
Definition at line 143 of file assMultipleChoiceTest.php.
146 $this->assertEquals(
'assMultipleChoice', $obj->getQuestionType());
Class for multiple choice tests.
◆ test_getThumbPrefix_shouldReturnString()
assMultipleChoiceTest::test_getThumbPrefix_shouldReturnString |
( |
| ) |
|
Definition at line 110 of file assMultipleChoiceTest.php.
113 $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 98 of file assMultipleChoiceTest.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());
Class for multiple choice tests.
◆ test_setOutputType_shouldReturngetOutputType()
assMultipleChoiceTest::test_setOutputType_shouldReturngetOutputType |
( |
| ) |
|
Definition at line 116 of file assMultipleChoiceTest.php.
119 $obj->setOutputType(0);
120 $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: