Unit tests.
More...
Unit tests.
- Author
- Guido Vollbach <gvollbachdatabay.de>
Definition at line 9 of file assLongMenuTest.php.
◆ getMethod()
static assLongmenuTest::getMethod |
( |
|
$name | ) |
|
|
staticprotected |
Definition at line 13 of file assLongMenuTest.php.
14 $class =
new ReflectionClass(
'assLongMenu');
15 $method = $class->getMethod($name);
16 $method->setAccessible(
true);
◆ setUp()
assLongmenuTest::setUp |
( |
| ) |
|
|
protected |
Definition at line 20 of file assLongMenuTest.php.
22 require_once
'./Modules/TestQuestionPool/classes/class.assLongMenu.php';
23 if (defined(
'ILIAS_PHPUNIT_CONTEXT'))
25 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
26 ilUnitUtil::performInitialisation();
30 chdir( dirname( __FILE__ ) );
33 require_once
'./Services/Utilities/classes/class.ilUtil.php';
◆ test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerDoesNotExistsInAnswers()
assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerDoesNotExistsInAnswers |
( |
| ) |
|
Definition at line 143 of file assLongMenuTest.php.
146 $obj->setCorrectAnswers(array ( 0 => array ( 0 =>array (0 =>
'answer'),1 =>
'2.25', 2 =>
'1')));
147 $obj->setAnswers(array(array(1)));
148 $this->assertEquals($obj->checkQuestionCustomPart(),
false);
◆ test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerHasNoAnswers()
assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerHasNoAnswers |
( |
| ) |
|
Definition at line 151 of file assLongMenuTest.php.
154 $obj->setCorrectAnswers(array ( 0 => array ( 0 =>array (),1 =>
'2.25', 2 =>
'1')));
155 $obj->setAnswers(array(array(
'answer')));
156 $this->assertEquals($obj->checkQuestionCustomPart(),
false);
◆ test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerHasNoPoints()
assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerHasNoPoints |
( |
| ) |
|
Definition at line 159 of file assLongMenuTest.php.
162 $obj->setCorrectAnswers(array ( 0 => array ( 0 =>array ())));
163 $obj->setAnswers(array(array(
'answer')));
164 $this->assertEquals($obj->checkQuestionCustomPart(),
false);
◆ test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerPointsAreZero()
assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerPointsAreZero |
( |
| ) |
|
Definition at line 167 of file assLongMenuTest.php.
170 $obj->setCorrectAnswers(array ( 0 => array ( 0 =>array (
'answer'),1 => 0, 2 =>
'1')));
171 $obj->setAnswers(array(array(
'answer')));
172 $this->assertEquals($obj->checkQuestionCustomPart(),
false);
◆ test_checkQuestionCustomPart_shouldBeFalseBecauseNoCustomPart()
assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseNoCustomPart |
( |
| ) |
|
Definition at line 115 of file assLongMenuTest.php.
118 $this->assertEquals($obj->checkQuestionCustomPart(),
false);
◆ test_checkQuestionCustomPart_shouldBeFalseBecauseOnlyAnswers()
assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseOnlyAnswers |
( |
| ) |
|
Definition at line 121 of file assLongMenuTest.php.
124 $obj->setAnswers(array(array(1,2,3,4)));
125 $this->assertEquals($obj->checkQuestionCustomPart(),
false);
◆ test_checkQuestionCustomPart_shouldBeFalseBecauseOnlyCorrectAnswers()
assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseOnlyCorrectAnswers |
( |
| ) |
|
Definition at line 128 of file assLongMenuTest.php.
131 $obj->setCorrectAnswers(array ( 0 => array ( 0 =>array (0 =>
'answer'),1 =>
'2.25', 2 =>
'1'),
132 1 => array ( 0 =>array (0 =>
'answer'),1 =>
'2.25', 2 =>
'1')));
133 $this->assertEquals($obj->checkQuestionCustomPart(),
false);
◆ test_checkQuestionCustomPart_shouldBeFalseBecauseToManyCorrectAnswers()
assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseToManyCorrectAnswers |
( |
| ) |
|
Definition at line 135 of file assLongMenuTest.php.
138 $obj->setCorrectAnswers(array ( 0 => array ( 0 =>array (0 =>
'answer'),1 =>
'2.25', 2 =>
'1'),
139 1 => array ( 0 =>array (0 =>
'answer'),1 =>
'2.25', 2 =>
'1')));
140 $obj->setAnswers(array(array(
'answer')));
141 $this->assertEquals($obj->checkQuestionCustomPart(),
false);
◆ test_checkQuestionCustomPart_shouldBeTrue()
assLongmenuTest::test_checkQuestionCustomPart_shouldBeTrue |
( |
| ) |
|
Definition at line 175 of file assLongMenuTest.php.
178 $obj->setCorrectAnswers(array ( 0 => array ( 0 =>array (
'answer'),1 => 1, 2 =>
'1')));
179 $obj->setAnswers(array(array(
'answer')));
180 $this->assertEquals($obj->checkQuestionCustomPart(),
true);
◆ test_correctAnswerDoesNotExistInAnswerOptions_shouldReturnFalse()
assLongmenuTest::test_correctAnswerDoesNotExistInAnswerOptions_shouldReturnFalse |
( |
| ) |
|
Definition at line 68 of file assLongMenuTest.php.
70 $method = self::getMethod(
'correctAnswerDoesNotExistInAnswerOptions');
72 $value = $method->invokeArgs($obj, array(array(array(1),1,1), array(1,2,3,4)));
73 $this->assertEquals(
false, $value);
◆ test_correctAnswerDoesNotExistInAnswerOptions_shouldReturnTrue()
assLongmenuTest::test_correctAnswerDoesNotExistInAnswerOptions_shouldReturnTrue |
( |
| ) |
|
Definition at line 60 of file assLongMenuTest.php.
62 $method = self::getMethod(
'correctAnswerDoesNotExistInAnswerOptions');
64 $value = $method->invokeArgs($obj, array(array(array(5),1,1), array(1,2,3,4)));
65 $this->assertEquals(
true, $value);
◆ test_getAdditionalTableName_shouldReturnString()
assLongmenuTest::test_getAdditionalTableName_shouldReturnString |
( |
| ) |
|
Definition at line 42 of file assLongMenuTest.php.
45 $this->assertEquals(
'qpl_qst_lome', $instance->getAdditionalTableName());
◆ test_getAnswerTableName_shouldReturnString()
assLongmenuTest::test_getAnswerTableName_shouldReturnString |
( |
| ) |
|
Definition at line 54 of file assLongMenuTest.php.
57 $this->assertEquals(
'qpl_a_lome', $instance->getAnswerTableName());
◆ test_getMaximumPoints_shouldBeFour()
assLongmenuTest::test_getMaximumPoints_shouldBeFour |
( |
| ) |
|
Definition at line 76 of file assLongMenuTest.php.
79 $obj->setCorrectAnswers(array ( 0 => array ( 0 =>array (0 =>
'answer'),1 =>
'2', 2 =>
'1'),
80 1 => array ( 0 =>array (0 =>
'answer'),1 =>
'2', 2 =>
'1')));
81 $value = $obj->getMaximumPoints();
82 $this->assertEquals(4, $value);
◆ test_getMaximumPoints_shouldBeFourPointFive()
assLongmenuTest::test_getMaximumPoints_shouldBeFourPointFive |
( |
| ) |
|
Definition at line 85 of file assLongMenuTest.php.
88 $obj->setCorrectAnswers(array ( 0 => array ( 0 =>array (0 =>
'answer'),1 =>
'2.25', 2 =>
'1'),
89 1 => array ( 0 =>array (0 =>
'answer'),1 =>
'2.25', 2 =>
'1')));
90 $value = $obj->getMaximumPoints();
91 $this->assertEquals(4.5, $value);
◆ test_getQuestionType_shouldReturnString()
assLongmenuTest::test_getQuestionType_shouldReturnString |
( |
| ) |
|
Definition at line 48 of file assLongMenuTest.php.
51 $this->assertEquals(
'assLongMenu', $instance->getQuestionType());
◆ test_getSolutionSubmit_shouldReturnSolution()
assLongmenuTest::test_getSolutionSubmit_shouldReturnSolution |
( |
| ) |
|
Definition at line 183 of file assLongMenuTest.php.
References $_POST.
186 $array = array( 0 =>
'squirrel', 1 =>
'icebear');
187 $_POST[
'answer'] = $array;
188 $this->assertEquals($obj->getSolutionSubmit(), $array);
◆ test_instantiateObject_shouldReturnInstance()
assLongmenuTest::test_instantiateObject_shouldReturnInstance |
( |
| ) |
|
◆ test_isComplete_shouldBeFalse()
assLongmenuTest::test_isComplete_shouldBeFalse |
( |
| ) |
|
Definition at line 94 of file assLongMenuTest.php.
97 $obj->setCorrectAnswers(array ( 0 => array ( 0 =>array (0 =>
'answer'),1 =>
'2.25', 2 =>
'1'),
98 1 => array ( 0 =>array (0 =>
'answer'),1 =>
'2.25', 2 =>
'1')));
99 $obj->setAnswers(array(array(1,2,3,4)));
100 $this->assertEquals($obj->isComplete(),
false);
◆ test_isComplete_shouldBeTrue()
assLongmenuTest::test_isComplete_shouldBeTrue |
( |
| ) |
|
Definition at line 103 of file assLongMenuTest.php.
106 $obj->setCorrectAnswers(array ( 0 => array ( 0 =>array (0 =>
'answer'),1 =>
'2.25', 2 =>
'1'),
107 1 => array ( 0 =>array (0 =>
'answer'),1 =>
'2.25', 2 =>
'1')));
108 $obj->setAnswers(array(array(1,2,3,4)));
109 $obj->setPoints(4.5);
110 $obj->setTitle(
'LongMenu Title');
111 $obj->setQuestion(
'LongMenu Question');
112 $this->assertEquals($obj->isComplete(),
true);
◆ test_isShuffleAnswersEnabled_shouldReturnFalse()
assLongmenuTest::test_isShuffleAnswersEnabled_shouldReturnFalse |
( |
| ) |
|
Definition at line 212 of file assLongMenuTest.php.
215 $this->assertEquals(
false, $obj->isShuffleAnswersEnabled());
216 $this->assertNotEquals(
true, $obj->isShuffleAnswersEnabled());
◆ test_setAnswerType_shouldReturnGetAnswerType()
assLongmenuTest::test_setAnswerType_shouldReturnGetAnswerType |
( |
| ) |
|
Definition at line 191 of file assLongMenuTest.php.
194 $obj->setAnswerType(0);
195 $this->assertEquals(0, $obj->getAnswerType());
◆ test_setJsonStructure_shouldReturnGetJsonStructure()
assLongmenuTest::test_setJsonStructure_shouldReturnGetJsonStructure |
( |
| ) |
|
Definition at line 205 of file assLongMenuTest.php.
208 $obj->setJsonStructure(json_encode(array(1 =>
'bla')));
209 $this->assertEquals(
'{"1":"bla"}', $obj->getJsonStructure());
◆ test_setLongMenuTextValue_shouldReturnGetLongMenuTextValue()
assLongmenuTest::test_setLongMenuTextValue_shouldReturnGetLongMenuTextValue |
( |
| ) |
|
Definition at line 197 of file assLongMenuTest.php.
200 $this->assertEquals(
'', $obj->getLongMenuTextValue());
201 $obj->setLongMenuTextValue(
'dummy text');
202 $this->assertEquals(
'dummy text', $obj->getLongMenuTextValue());
◆ $backupGlobals
assLongmenuTest::$backupGlobals = FALSE |
|
protected |
The documentation for this class was generated from the following file: