ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
assLongmenuTest Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for assLongmenuTest:
+ Collaboration diagram for assLongmenuTest:

Public Member Functions

 test_instantiateObject_shouldReturnInstance ()
 
 test_getAdditionalTableName_shouldReturnString ()
 
 test_getQuestionType_shouldReturnString ()
 
 test_getAnswerTableName_shouldReturnString ()
 
 test_correctAnswerDoesNotExistInAnswerOptions_shouldReturnTrue ()
 
 test_correctAnswerDoesNotExistInAnswerOptions_shouldReturnFalse ()
 
 test_getMaximumPoints_shouldBeFour ()
 
 test_getMaximumPoints_shouldBeFourPointFive ()
 
 test_isComplete_shouldBeFalse ()
 
 test_checkQuestionCustomPart_shouldBeFalseBecauseNoCustomPart ()
 
 test_checkQuestionCustomPart_shouldBeFalseBecauseOnlyAnswers ()
 
 test_checkQuestionCustomPart_shouldBeFalseBecauseOnlyCorrectAnswers ()
 
 test_checkQuestionCustomPart_shouldBeFalseBecauseToManyCorrectAnswers ()
 
 test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerDoesNotExistsInAnswers ()
 
 test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerHasNoAnswers ()
 
 test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerHasNoPoints ()
 
 test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerPointsAreZero ()
 
 test_checkQuestionCustomPart_shouldBeTrue ()
 
 test_setAnswerType_shouldReturnGetAnswerType ()
 
 test_isShuffleAnswersEnabled_shouldReturnFalse ()
 

Protected Member Functions

 setUp ()
 
- Protected Member Functions inherited from assBaseTestCase
 setUp ()
 
 tearDown ()
 
 getIRSSMock ()
 

Static Protected Member Functions

static getMethod ($name)
 

Protected Attributes

 $backupGlobals = false
 
- Protected Attributes inherited from assBaseTestCase
Container $dic = null
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Unit tests

Author
Guido Vollbach <gvollbachdatabay.de>

\

Definition at line 26 of file assLongMenuTest.php.

Member Function Documentation

◆ getMethod()

static assLongmenuTest::getMethod (   $name)
staticprotected

Definition at line 31 of file assLongMenuTest.php.

31 : ReflectionMethod
32 {
33 $class = new ReflectionClass(assLongMenu::class);
34 $method = $class->getMethod($name);
35 return $method;
36 }

Referenced by test_correctAnswerDoesNotExistInAnswerOptions_shouldReturnFalse(), and test_correctAnswerDoesNotExistInAnswerOptions_shouldReturnTrue().

+ Here is the caller graph for this function:

◆ setUp()

assLongmenuTest::setUp ( )
protected

Reimplemented from assBaseTestCase.

Definition at line 38 of file assLongMenuTest.php.

38 : void
39 {
40 chdir(__DIR__ . '/../../../../');
41
42 parent::setUp();
43
44 $ilCtrl_mock = $this->createMock('ilCtrl');
45 $ilCtrl_mock->expects($this->any())->method('saveParameter');
46 $ilCtrl_mock->expects($this->any())->method('saveParameterByClass');
47 $this->setGlobalVariable('ilCtrl', $ilCtrl_mock);
48
49 $lng_mock = $this->createMock('ilLanguage', ['txt'], [], '', false);
50 $this->setGlobalVariable('lng', $lng_mock);
51
52 $this->setGlobalVariable('ilias', $this->getIliasMock());
53 $this->setGlobalVariable('ilDB', $this->getDatabaseMock());
54 }
setGlobalVariable(string $name, mixed $value)

References getDatabaseMock(), getIliasMock(), and setGlobalVariable().

+ Here is the call graph for this function:

◆ test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerDoesNotExistsInAnswers()

assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerDoesNotExistsInAnswers ( )

Definition at line 159 of file assLongMenuTest.php.

159 : void
160 {
161 $obj = new assLongMenu();
162 $obj->setCorrectAnswers([0 => [0 => [0 => 'answer'], 1 => '2.25', 2 => '1']]);
163 $obj->setAnswers([[1]]);
164 $this->assertEquals($obj->checkQuestionCustomPart(), false);
165 }

◆ test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerHasNoAnswers()

assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerHasNoAnswers ( )

Definition at line 167 of file assLongMenuTest.php.

167 : void
168 {
169 $obj = new assLongMenu();
170 $obj->setCorrectAnswers([0 => [0 => [], 1 => '2.25', 2 => '1']]);
171 $obj->setAnswers([['answer']]);
172 $this->assertEquals($obj->checkQuestionCustomPart(), false);
173 }

◆ test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerHasNoPoints()

assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerHasNoPoints ( )

Definition at line 175 of file assLongMenuTest.php.

175 : void
176 {
177 $obj = new assLongMenu();
178 $obj->setCorrectAnswers([0 => [0 => []]]);
179 $obj->setAnswers([['answer']]);
180 $this->assertEquals($obj->checkQuestionCustomPart(), false);
181 }

◆ test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerPointsAreZero()

assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerPointsAreZero ( )

Definition at line 183 of file assLongMenuTest.php.

183 : void
184 {
185 $obj = new assLongMenu();
186 $obj->setCorrectAnswers([0 => [0 => ['answer'], 1 => 0, 2 => '1']]);
187 $obj->setAnswers([['answer']]);
188 $this->assertEquals($obj->checkQuestionCustomPart(), false);
189 }

◆ test_checkQuestionCustomPart_shouldBeFalseBecauseNoCustomPart()

assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseNoCustomPart ( )

Definition at line 133 of file assLongMenuTest.php.

133 : void
134 {
135 $obj = new assLongMenu();
136 $this->assertEquals($obj->checkQuestionCustomPart(), false);
137 }

◆ test_checkQuestionCustomPart_shouldBeFalseBecauseOnlyAnswers()

assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseOnlyAnswers ( )

Definition at line 139 of file assLongMenuTest.php.

139 : void
140 {
141 $obj = new assLongMenu();
142 $obj->setAnswers([[1,2,3,4]]);
143 $this->assertEquals($obj->checkQuestionCustomPart(), false);
144 }

◆ test_checkQuestionCustomPart_shouldBeFalseBecauseOnlyCorrectAnswers()

assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseOnlyCorrectAnswers ( )

Definition at line 146 of file assLongMenuTest.php.

146 : void
147 {
148 $obj = new assLongMenu();
149 $obj->setCorrectAnswers([0 => [0 => [0 => 'answer'], 1 => '2.25', 2 => '1'], 1 => [0 => [0 => 'answer'], 1 => '2.25', 2 => '1']]);
150 $this->assertEquals($obj->checkQuestionCustomPart(), false);
151 }

◆ test_checkQuestionCustomPart_shouldBeFalseBecauseToManyCorrectAnswers()

assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseToManyCorrectAnswers ( )

Definition at line 152 of file assLongMenuTest.php.

152 : void
153 {
154 $obj = new assLongMenu();
155 $obj->setCorrectAnswers([0 => [0 => [0 => 'answer'], 1 => '2.25', 2 => '1'], 1 => [0 => [0 => 'answer'], 1 => '2.25', 2 => '1']]);
156 $obj->setAnswers([['answer']]);
157 $this->assertEquals($obj->checkQuestionCustomPart(), false);
158 }

◆ test_checkQuestionCustomPart_shouldBeTrue()

assLongmenuTest::test_checkQuestionCustomPart_shouldBeTrue ( )

Definition at line 191 of file assLongMenuTest.php.

191 : void
192 {
193 $obj = new assLongMenu();
194 $obj->setCorrectAnswers([0 => [0 => ['answer'], 1 => 1, 2 => '1']]);
195 $obj->setAnswers([['answer']]);
196 $this->assertEquals($obj->checkQuestionCustomPart(), true);
197 }

◆ test_correctAnswerDoesNotExistInAnswerOptions_shouldReturnFalse()

assLongmenuTest::test_correctAnswerDoesNotExistInAnswerOptions_shouldReturnFalse ( )

Definition at line 88 of file assLongMenuTest.php.

88 : void
89 {
90 $method = self::getMethod('correctAnswerDoesNotExistInAnswerOptions');
91 $obj = new assLongMenu();
92 $value = $method->invokeArgs($obj, [[[1],1,1], [1,2,3,4]]);
93 $this->assertEquals(false, $value);
94 }
static getMethod($name)

References getMethod().

+ Here is the call graph for this function:

◆ test_correctAnswerDoesNotExistInAnswerOptions_shouldReturnTrue()

assLongmenuTest::test_correctAnswerDoesNotExistInAnswerOptions_shouldReturnTrue ( )

Definition at line 80 of file assLongMenuTest.php.

80 : void
81 {
82 $method = self::getMethod('correctAnswerDoesNotExistInAnswerOptions');
83 $obj = new assLongMenu();
84 $value = $method->invokeArgs($obj, [[[5],1,1], [1,2,3,4]]);
85 $this->assertEquals(true, $value);
86 }

References getMethod().

+ Here is the call graph for this function:

◆ test_getAdditionalTableName_shouldReturnString()

assLongmenuTest::test_getAdditionalTableName_shouldReturnString ( )

Definition at line 62 of file assLongMenuTest.php.

62 : void
63 {
64 $instance = new assLongMenu();
65 $this->assertEquals('qpl_qst_lome', $instance->getAdditionalTableName());
66 }

◆ test_getAnswerTableName_shouldReturnString()

assLongmenuTest::test_getAnswerTableName_shouldReturnString ( )

Definition at line 74 of file assLongMenuTest.php.

74 : void
75 {
76 $instance = new assLongMenu();
77 $this->assertEquals('qpl_a_lome', $instance->getAnswerTableName());
78 }

◆ test_getMaximumPoints_shouldBeFour()

assLongmenuTest::test_getMaximumPoints_shouldBeFour ( )

Definition at line 96 of file assLongMenuTest.php.

96 : void
97 {
98 $obj = new assLongMenu();
99 $obj->setCorrectAnswers([0 => [0 => [0 => 'answer'], 1 => '2', 2 => '1'], 1 => [0 => [0 => 'answer'], 1 => '2', 2 => '1']]);
100 $value = $obj->getMaximumPoints();
101 $this->assertEquals(4, $value);
102 }

◆ test_getMaximumPoints_shouldBeFourPointFive()

assLongmenuTest::test_getMaximumPoints_shouldBeFourPointFive ( )

Definition at line 104 of file assLongMenuTest.php.

104 : void
105 {
106 $obj = new assLongMenu();
107 $obj->setCorrectAnswers([0 => [0 => [0 => 'answer'], 1 => '2.25', 2 => '1'], 1 => [0 => [0 => 'answer'], 1 => '2.25', 2 => '1']]);
108 $value = $obj->getMaximumPoints();
109 $this->assertEquals(4.5, $value);
110 }

◆ test_getQuestionType_shouldReturnString()

assLongmenuTest::test_getQuestionType_shouldReturnString ( )

Definition at line 68 of file assLongMenuTest.php.

68 : void
69 {
70 $instance = new assLongMenu();
71 $this->assertEquals('assLongMenu', $instance->getQuestionType());
72 }

◆ test_instantiateObject_shouldReturnInstance()

assLongmenuTest::test_instantiateObject_shouldReturnInstance ( )

Definition at line 56 of file assLongMenuTest.php.

56 : void
57 {
58 $instance = new assLongMenu();
59 $this->assertInstanceOf(assLongMenu::class, $instance);
60 }

◆ test_isComplete_shouldBeFalse()

assLongmenuTest::test_isComplete_shouldBeFalse ( )

Definition at line 112 of file assLongMenuTest.php.

112 : void
113 {
114 $obj = new assLongMenu();
115 $obj->setCorrectAnswers([0 => [0 => [0 => 'answer'], 1 => '2.25', 2 => '1'], 1 => [0 => [0 => 'answer'], 1 => '2.25', 2 => '1']]);
116 $obj->setAnswers([[1,2,3,4]]);
117 $this->assertEquals($obj->isComplete(), false);
118 }

◆ test_isShuffleAnswersEnabled_shouldReturnFalse()

assLongmenuTest::test_isShuffleAnswersEnabled_shouldReturnFalse ( )

Definition at line 215 of file assLongMenuTest.php.

215 : void
216 {
217 $obj = new assLongMenu();
218 $this->assertEquals(false, $obj->isShuffleAnswersEnabled());
219 $this->assertNotEquals(true, $obj->isShuffleAnswersEnabled());
220 }

◆ test_setAnswerType_shouldReturnGetAnswerType()

assLongmenuTest::test_setAnswerType_shouldReturnGetAnswerType ( )

Definition at line 199 of file assLongMenuTest.php.

199 : void
200 {
201 $obj = new assLongMenu();
202 $obj->setAnswerType([]);
203 $this->assertEquals([], $obj->getAnswerType());
204 }

Field Documentation

◆ $backupGlobals

assLongmenuTest::$backupGlobals = false
protected

Definition at line 28 of file assLongMenuTest.php.


The documentation for this class was generated from the following file: