ILIAS  trunk Revision v5.2.0beta1-34132-g2d4d73d4a0
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_getSolutionSubmit_shouldReturnSolution ()
 
 test_setAnswerType_shouldReturnGetAnswerType ()
 
 test_setJsonStructure_shouldReturnGetJsonStructure ()
 
 test_isShuffleAnswersEnabled_shouldReturnFalse ()
 

Protected Member Functions

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

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.

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

◆ setUp()

assLongmenuTest::setUp ( )
protected

Definition at line 39 of file assLongMenuTest.php.

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

◆ test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerDoesNotExistsInAnswers()

assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerDoesNotExistsInAnswers ( )

Definition at line 161 of file assLongMenuTest.php.

161  : void
162  {
163  $obj = new assLongMenu();
164  $obj->setCorrectAnswers([0 => [0 => [0 => 'answer'], 1 => '2.25', 2 => '1']]);
165  $obj->setAnswers([[1]]);
166  $this->assertEquals($obj->checkQuestionCustomPart(), false);
167  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerHasNoAnswers()

assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerHasNoAnswers ( )

Definition at line 169 of file assLongMenuTest.php.

169  : void
170  {
171  $obj = new assLongMenu();
172  $obj->setCorrectAnswers([0 => [0 => [], 1 => '2.25', 2 => '1']]);
173  $obj->setAnswers([['answer']]);
174  $this->assertEquals($obj->checkQuestionCustomPart(), false);
175  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerHasNoPoints()

assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerHasNoPoints ( )

Definition at line 177 of file assLongMenuTest.php.

177  : void
178  {
179  $obj = new assLongMenu();
180  $obj->setCorrectAnswers([0 => [0 => []]]);
181  $obj->setAnswers([['answer']]);
182  $this->assertEquals($obj->checkQuestionCustomPart(), false);
183  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerPointsAreZero()

assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerPointsAreZero ( )

Definition at line 185 of file assLongMenuTest.php.

185  : void
186  {
187  $obj = new assLongMenu();
188  $obj->setCorrectAnswers([0 => [0 => ['answer'], 1 => 0, 2 => '1']]);
189  $obj->setAnswers([['answer']]);
190  $this->assertEquals($obj->checkQuestionCustomPart(), false);
191  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_checkQuestionCustomPart_shouldBeFalseBecauseNoCustomPart()

assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseNoCustomPart ( )

Definition at line 135 of file assLongMenuTest.php.

135  : void
136  {
137  $obj = new assLongMenu();
138  $this->assertEquals($obj->checkQuestionCustomPart(), false);
139  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_checkQuestionCustomPart_shouldBeFalseBecauseOnlyAnswers()

assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseOnlyAnswers ( )

Definition at line 141 of file assLongMenuTest.php.

141  : void
142  {
143  $obj = new assLongMenu();
144  $obj->setAnswers([[1,2,3,4]]);
145  $this->assertEquals($obj->checkQuestionCustomPart(), false);
146  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_checkQuestionCustomPart_shouldBeFalseBecauseOnlyCorrectAnswers()

assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseOnlyCorrectAnswers ( )

Definition at line 148 of file assLongMenuTest.php.

148  : void
149  {
150  $obj = new assLongMenu();
151  $obj->setCorrectAnswers([0 => [0 => [0 => 'answer'], 1 => '2.25', 2 => '1'], 1 => [0 => [0 => 'answer'], 1 => '2.25', 2 => '1']]);
152  $this->assertEquals($obj->checkQuestionCustomPart(), false);
153  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_checkQuestionCustomPart_shouldBeFalseBecauseToManyCorrectAnswers()

assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseToManyCorrectAnswers ( )

Definition at line 154 of file assLongMenuTest.php.

154  : void
155  {
156  $obj = new assLongMenu();
157  $obj->setCorrectAnswers([0 => [0 => [0 => 'answer'], 1 => '2.25', 2 => '1'], 1 => [0 => [0 => 'answer'], 1 => '2.25', 2 => '1']]);
158  $obj->setAnswers([['answer']]);
159  $this->assertEquals($obj->checkQuestionCustomPart(), false);
160  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_checkQuestionCustomPart_shouldBeTrue()

assLongmenuTest::test_checkQuestionCustomPart_shouldBeTrue ( )

Definition at line 193 of file assLongMenuTest.php.

193  : void
194  {
195  $obj = new assLongMenu();
196  $obj->setCorrectAnswers([0 => [0 => ['answer'], 1 => 1, 2 => '1']]);
197  $obj->setAnswers([['answer']]);
198  $this->assertEquals($obj->checkQuestionCustomPart(), true);
199  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_correctAnswerDoesNotExistInAnswerOptions_shouldReturnFalse()

assLongmenuTest::test_correctAnswerDoesNotExistInAnswerOptions_shouldReturnFalse ( )

Definition at line 90 of file assLongMenuTest.php.

90  : void
91  {
92  $method = self::getMethod('correctAnswerDoesNotExistInAnswerOptions');
93  $obj = new assLongMenu();
94  $value = $method->invokeArgs($obj, [[[1],1,1], [1,2,3,4]]);
95  $this->assertEquals(false, $value);
96  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_correctAnswerDoesNotExistInAnswerOptions_shouldReturnTrue()

assLongmenuTest::test_correctAnswerDoesNotExistInAnswerOptions_shouldReturnTrue ( )

Definition at line 82 of file assLongMenuTest.php.

82  : void
83  {
84  $method = self::getMethod('correctAnswerDoesNotExistInAnswerOptions');
85  $obj = new assLongMenu();
86  $value = $method->invokeArgs($obj, [[[5],1,1], [1,2,3,4]]);
87  $this->assertEquals(true, $value);
88  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_getAdditionalTableName_shouldReturnString()

assLongmenuTest::test_getAdditionalTableName_shouldReturnString ( )

Definition at line 64 of file assLongMenuTest.php.

64  : void
65  {
66  $instance = new assLongMenu();
67  $this->assertEquals('qpl_qst_lome', $instance->getAdditionalTableName());
68  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_getAnswerTableName_shouldReturnString()

assLongmenuTest::test_getAnswerTableName_shouldReturnString ( )

Definition at line 76 of file assLongMenuTest.php.

76  : void
77  {
78  $instance = new assLongMenu();
79  $this->assertEquals('qpl_a_lome', $instance->getAnswerTableName());
80  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_getMaximumPoints_shouldBeFour()

assLongmenuTest::test_getMaximumPoints_shouldBeFour ( )

Definition at line 98 of file assLongMenuTest.php.

98  : void
99  {
100  $obj = new assLongMenu();
101  $obj->setCorrectAnswers([0 => [0 => [0 => 'answer'], 1 => '2', 2 => '1'], 1 => [0 => [0 => 'answer'], 1 => '2', 2 => '1']]);
102  $value = $obj->getMaximumPoints();
103  $this->assertEquals(4, $value);
104  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_getMaximumPoints_shouldBeFourPointFive()

assLongmenuTest::test_getMaximumPoints_shouldBeFourPointFive ( )

Definition at line 106 of file assLongMenuTest.php.

106  : void
107  {
108  $obj = new assLongMenu();
109  $obj->setCorrectAnswers([0 => [0 => [0 => 'answer'], 1 => '2.25', 2 => '1'], 1 => [0 => [0 => 'answer'], 1 => '2.25', 2 => '1']]);
110  $value = $obj->getMaximumPoints();
111  $this->assertEquals(4.5, $value);
112  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_getQuestionType_shouldReturnString()

assLongmenuTest::test_getQuestionType_shouldReturnString ( )

Definition at line 70 of file assLongMenuTest.php.

70  : void
71  {
72  $instance = new assLongMenu();
73  $this->assertEquals('assLongMenu', $instance->getQuestionType());
74  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_getSolutionSubmit_shouldReturnSolution()

assLongmenuTest::test_getSolutionSubmit_shouldReturnSolution ( )

Definition at line 201 of file assLongMenuTest.php.

201  : void
202  {
203  $obj = new assLongMenu();
204  $array = [0 => 'squirrel', 1 => 'icebear'];
205  $_POST['answer'] = $array;
206  $this->assertEquals($obj->getSolutionSubmit(), $array);
207  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_instantiateObject_shouldReturnInstance()

assLongmenuTest::test_instantiateObject_shouldReturnInstance ( )

Definition at line 58 of file assLongMenuTest.php.

58  : void
59  {
60  $instance = new assLongMenu();
61  $this->assertInstanceOf(assLongMenu::class, $instance);
62  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_isComplete_shouldBeFalse()

assLongmenuTest::test_isComplete_shouldBeFalse ( )

Definition at line 114 of file assLongMenuTest.php.

114  : void
115  {
116  $obj = new assLongMenu();
117  $obj->setCorrectAnswers([0 => [0 => [0 => 'answer'], 1 => '2.25', 2 => '1'], 1 => [0 => [0 => 'answer'], 1 => '2.25', 2 => '1']]);
118  $obj->setAnswers([[1,2,3,4]]);
119  $this->assertEquals($obj->isComplete(), false);
120  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_isShuffleAnswersEnabled_shouldReturnFalse()

assLongmenuTest::test_isShuffleAnswersEnabled_shouldReturnFalse ( )

Definition at line 232 of file assLongMenuTest.php.

232  : void
233  {
234  $obj = new assLongMenu();
235  $this->assertEquals(false, $obj->isShuffleAnswersEnabled());
236  $this->assertNotEquals(true, $obj->isShuffleAnswersEnabled());
237  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_setAnswerType_shouldReturnGetAnswerType()

assLongmenuTest::test_setAnswerType_shouldReturnGetAnswerType ( )

Definition at line 209 of file assLongMenuTest.php.

209  : void
210  {
211  $obj = new assLongMenu();
212  $obj->setAnswerType([]);
213  $this->assertEquals([], $obj->getAnswerType());
214  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_setJsonStructure_shouldReturnGetJsonStructure()

assLongmenuTest::test_setJsonStructure_shouldReturnGetJsonStructure ( )

Definition at line 225 of file assLongMenuTest.php.

225  : void
226  {
227  $obj = new assLongMenu();
228  $obj->setJsonStructure(json_encode([1 => 'bla']));
229  $this->assertEquals('{"1":"bla"}', $obj->getJsonStructure());
230  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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: