Unit tests.
More...
Unit tests.
- Author
- Guido Vollbach <gvollbachdatabay.de>
Definition at line 9 of file assLongMenuTest.php.
◆ getMethod()
static assLongmenuTest::getMethod |
( |
|
$name | ) |
|
|
staticprotected |
◆ setUp()
assLongmenuTest::setUp |
( |
| ) |
|
|
protected |
Reimplemented from assBaseTestCase.
Definition at line 22 of file assLongMenuTest.php.
22 : void
23 {
25
26 require_once './Modules/TestQuestionPool/classes/class.assLongMenu.php';
27 if (defined('ILIAS_PHPUNIT_CONTEXT')) {
28 include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
29 ilUnitUtil::performInitialisation();
30 } else {
31 chdir(dirname(__FILE__));
32 chdir('../../../');
33 }
34 require_once './Services/Utilities/classes/class.ilUtil.php';
35 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
References $GLOBALS.
◆ test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerDoesNotExistsInAnswers()
assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerDoesNotExistsInAnswers |
( |
| ) |
|
Definition at line 145 of file assLongMenuTest.php.
146 {
148 $obj->setCorrectAnswers(array( 0 => array( 0 => array(0 => 'answer'),1 => '2.25', 2 => '1')));
149 $obj->setAnswers(array(array(1)));
150 $this->assertEquals($obj->checkQuestionCustomPart(), false);
151 }
◆ test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerHasNoAnswers()
assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerHasNoAnswers |
( |
| ) |
|
Definition at line 153 of file assLongMenuTest.php.
154 {
156 $obj->setCorrectAnswers(array( 0 => array( 0 => array(),1 => '2.25', 2 => '1')));
157 $obj->setAnswers(array(array('answer')));
158 $this->assertEquals($obj->checkQuestionCustomPart(), false);
159 }
◆ test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerHasNoPoints()
assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerHasNoPoints |
( |
| ) |
|
Definition at line 161 of file assLongMenuTest.php.
162 {
164 $obj->setCorrectAnswers(array( 0 => array( 0 => array())));
165 $obj->setAnswers(array(array('answer')));
166 $this->assertEquals($obj->checkQuestionCustomPart(), false);
167 }
◆ test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerPointsAreZero()
assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerPointsAreZero |
( |
| ) |
|
Definition at line 169 of file assLongMenuTest.php.
170 {
172 $obj->setCorrectAnswers(array( 0 => array( 0 => array('answer'),1 => 0, 2 => '1')));
173 $obj->setAnswers(array(array('answer')));
174 $this->assertEquals($obj->checkQuestionCustomPart(), false);
175 }
◆ test_checkQuestionCustomPart_shouldBeFalseBecauseNoCustomPart()
assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseNoCustomPart |
( |
| ) |
|
Definition at line 117 of file assLongMenuTest.php.
118 {
120 $this->assertEquals($obj->checkQuestionCustomPart(), false);
121 }
◆ test_checkQuestionCustomPart_shouldBeFalseBecauseOnlyAnswers()
assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseOnlyAnswers |
( |
| ) |
|
Definition at line 123 of file assLongMenuTest.php.
124 {
126 $obj->setAnswers(array(array(1,2,3,4)));
127 $this->assertEquals($obj->checkQuestionCustomPart(), false);
128 }
◆ test_checkQuestionCustomPart_shouldBeFalseBecauseOnlyCorrectAnswers()
assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseOnlyCorrectAnswers |
( |
| ) |
|
Definition at line 130 of file assLongMenuTest.php.
131 {
133 $obj->setCorrectAnswers(array( 0 => array( 0 => array(0 => 'answer'),1 => '2.25', 2 => '1'),
134 1 => array( 0 => array(0 => 'answer'),1 => '2.25', 2 => '1')));
135 $this->assertEquals($obj->checkQuestionCustomPart(), false);
136 }
◆ test_checkQuestionCustomPart_shouldBeFalseBecauseToManyCorrectAnswers()
assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseToManyCorrectAnswers |
( |
| ) |
|
Definition at line 137 of file assLongMenuTest.php.
138 {
140 $obj->setCorrectAnswers(array( 0 => array( 0 => array(0 => 'answer'),1 => '2.25', 2 => '1'),
141 1 => array( 0 => array(0 => 'answer'),1 => '2.25', 2 => '1')));
142 $obj->setAnswers(array(array('answer')));
143 $this->assertEquals($obj->checkQuestionCustomPart(), false);
144 }
◆ test_checkQuestionCustomPart_shouldBeTrue()
assLongmenuTest::test_checkQuestionCustomPart_shouldBeTrue |
( |
| ) |
|
Definition at line 177 of file assLongMenuTest.php.
178 {
180 $obj->setCorrectAnswers(array( 0 => array( 0 => array('answer'),1 => 1, 2 => '1')));
181 $obj->setAnswers(array(array('answer')));
182 $this->assertEquals($obj->checkQuestionCustomPart(), true);
183 }
◆ test_correctAnswerDoesNotExistInAnswerOptions_shouldReturnFalse()
assLongmenuTest::test_correctAnswerDoesNotExistInAnswerOptions_shouldReturnFalse |
( |
| ) |
|
Definition at line 69 of file assLongMenuTest.php.
70 {
73 $value = $method->invokeArgs($obj, array(array(array(1),1,1), array(1,2,3,4)));
74 $this->assertEquals(false, $value);
75 }
References getMethod().
◆ test_correctAnswerDoesNotExistInAnswerOptions_shouldReturnTrue()
assLongmenuTest::test_correctAnswerDoesNotExistInAnswerOptions_shouldReturnTrue |
( |
| ) |
|
Definition at line 61 of file assLongMenuTest.php.
62 {
65 $value = $method->invokeArgs($obj, array(array(array(5),1,1), array(1,2,3,4)));
66 $this->assertEquals(true, $value);
67 }
References getMethod().
◆ test_getAdditionalTableName_shouldReturnString()
assLongmenuTest::test_getAdditionalTableName_shouldReturnString |
( |
| ) |
|
Definition at line 43 of file assLongMenuTest.php.
44 {
46 $this->assertEquals('qpl_qst_lome', $instance->getAdditionalTableName());
47 }
◆ test_getAnswerTableName_shouldReturnString()
assLongmenuTest::test_getAnswerTableName_shouldReturnString |
( |
| ) |
|
Definition at line 55 of file assLongMenuTest.php.
56 {
58 $this->assertEquals('qpl_a_lome', $instance->getAnswerTableName());
59 }
◆ test_getMaximumPoints_shouldBeFour()
assLongmenuTest::test_getMaximumPoints_shouldBeFour |
( |
| ) |
|
Definition at line 77 of file assLongMenuTest.php.
78 {
80 $obj->setCorrectAnswers(array( 0 => array( 0 => array(0 => 'answer'),1 => '2', 2 => '1'),
81 1 => array( 0 => array(0 => 'answer'),1 => '2', 2 => '1')));
82 $value = $obj->getMaximumPoints();
83 $this->assertEquals(4, $value);
84 }
◆ test_getMaximumPoints_shouldBeFourPointFive()
assLongmenuTest::test_getMaximumPoints_shouldBeFourPointFive |
( |
| ) |
|
Definition at line 86 of file assLongMenuTest.php.
87 {
89 $obj->setCorrectAnswers(array( 0 => array( 0 => array(0 => 'answer'),1 => '2.25', 2 => '1'),
90 1 => array( 0 => array(0 => 'answer'),1 => '2.25', 2 => '1')));
91 $value = $obj->getMaximumPoints();
92 $this->assertEquals(4.5, $value);
93 }
◆ test_getQuestionType_shouldReturnString()
assLongmenuTest::test_getQuestionType_shouldReturnString |
( |
| ) |
|
Definition at line 49 of file assLongMenuTest.php.
50 {
52 $this->assertEquals('assLongMenu', $instance->getQuestionType());
53 }
◆ test_getSolutionSubmit_shouldReturnSolution()
assLongmenuTest::test_getSolutionSubmit_shouldReturnSolution |
( |
| ) |
|
Definition at line 185 of file assLongMenuTest.php.
186 {
188 $array = array( 0 => 'squirrel', 1 => 'icebear');
189 $_POST[
'answer'] = $array;
190 $this->assertEquals($obj->getSolutionSubmit(), $array);
191 }
References $_POST.
◆ test_instantiateObject_shouldReturnInstance()
assLongmenuTest::test_instantiateObject_shouldReturnInstance |
( |
| ) |
|
Definition at line 37 of file assLongMenuTest.php.
38 {
40 $this->assertInstanceOf('assLongMenu', $instance);
41 }
◆ test_isComplete_shouldBeFalse()
assLongmenuTest::test_isComplete_shouldBeFalse |
( |
| ) |
|
Definition at line 95 of file assLongMenuTest.php.
96 {
98 $obj->setCorrectAnswers(array( 0 => array( 0 => array(0 => 'answer'),1 => '2.25', 2 => '1'),
99 1 => array( 0 => array(0 => 'answer'),1 => '2.25', 2 => '1')));
100 $obj->setAnswers(array(array(1,2,3,4)));
101 $this->assertEquals($obj->isComplete(), false);
102 }
◆ test_isShuffleAnswersEnabled_shouldReturnFalse()
assLongmenuTest::test_isShuffleAnswersEnabled_shouldReturnFalse |
( |
| ) |
|
Definition at line 216 of file assLongMenuTest.php.
217 {
219 $this->assertEquals(false, $obj->isShuffleAnswersEnabled());
220 $this->assertNotEquals(true, $obj->isShuffleAnswersEnabled());
221 }
◆ test_setAnswerType_shouldReturnGetAnswerType()
assLongmenuTest::test_setAnswerType_shouldReturnGetAnswerType |
( |
| ) |
|
Definition at line 193 of file assLongMenuTest.php.
194 {
196 $obj->setAnswerType(0);
197 $this->assertEquals(0, $obj->getAnswerType());
198 }
◆ test_setJsonStructure_shouldReturnGetJsonStructure()
assLongmenuTest::test_setJsonStructure_shouldReturnGetJsonStructure |
( |
| ) |
|
Definition at line 209 of file assLongMenuTest.php.
210 {
212 $obj->setJsonStructure(json_encode(array(1 => 'bla')));
213 $this->assertEquals('{"1":"bla"}', $obj->getJsonStructure());
214 }
◆ $backupGlobals
assLongmenuTest::$backupGlobals = false |
|
protected |
The documentation for this class was generated from the following file: