ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 ()
 
 setGlobalVariable (string $name, $value)
 
 getGlobalTemplateMock ()
 
 getDatabaseMock ()
 
 getIRSSMock ()
 
 getFileDeliveryMock ()
 
 getIliasMock ()
 
 addGlobal_uiFactory ()
 
 addGlobal_uiRenderer ()
 

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');
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.

References assBaseTestCase\getDatabaseMock(), assBaseTestCase\getGlobalTemplateMock(), assBaseTestCase\getIliasMock(), and assBaseTestCase\setGlobalVariable().

39  : void
40  {
41  chdir(dirname(__FILE__));
42  chdir('../../../');
43 
44  parent::setUp();
45 
46  $ilCtrl_mock = $this->createMock('ilCtrl');
47  $ilCtrl_mock->expects($this->any())->method('saveParameter');
48  $ilCtrl_mock->expects($this->any())->method('saveParameterByClass');
49  $this->setGlobalVariable('ilCtrl', $ilCtrl_mock);
50 
51  $lng_mock = $this->createMock('ilLanguage', array('txt'), array(), '', false);
52  //$lng_mock->expects( $this->once() )->method( 'txt' )->will( $this->returnValue('Test') );
53  $this->setGlobalVariable('lng', $lng_mock);
54 
55  $this->setGlobalVariable('ilias', $this->getIliasMock());
56  $this->setGlobalVariable('tpl', $this->getGlobalTemplateMock());
57  $this->setGlobalVariable('ilDB', $this->getDatabaseMock());
58  }
setGlobalVariable(string $name, $value)
+ Here is the call graph for this function:

◆ test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerDoesNotExistsInAnswers()

assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerDoesNotExistsInAnswers ( )

Definition at line 169 of file assLongMenuTest.php.

169  : void
170  {
171  $obj = new assLongMenu();
172  $obj->setCorrectAnswers(array( 0 => array( 0 => array(0 => 'answer'),1 => '2.25', 2 => '1')));
173  $obj->setAnswers(array(array(1)));
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_shouldBeFalseBecauseCorrectAnswerHasNoAnswers()

assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerHasNoAnswers ( )

Definition at line 177 of file assLongMenuTest.php.

177  : void
178  {
179  $obj = new assLongMenu();
180  $obj->setCorrectAnswers(array( 0 => array( 0 => array(),1 => '2.25', 2 => '1')));
181  $obj->setAnswers(array(array('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_shouldBeFalseBecauseCorrectAnswerHasNoPoints()

assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerHasNoPoints ( )

Definition at line 185 of file assLongMenuTest.php.

185  : void
186  {
187  $obj = new assLongMenu();
188  $obj->setCorrectAnswers(array( 0 => array( 0 => array())));
189  $obj->setAnswers(array(array('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_shouldBeFalseBecauseCorrectAnswerPointsAreZero()

assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseCorrectAnswerPointsAreZero ( )

Definition at line 193 of file assLongMenuTest.php.

193  : void
194  {
195  $obj = new assLongMenu();
196  $obj->setCorrectAnswers(array( 0 => array( 0 => array('answer'),1 => 0, 2 => '1')));
197  $obj->setAnswers(array(array('answer')));
198  $this->assertEquals($obj->checkQuestionCustomPart(), false);
199  }
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 141 of file assLongMenuTest.php.

141  : void
142  {
143  $obj = new assLongMenu();
144  $this->assertEquals($obj->checkQuestionCustomPart(), false);
145  }
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 147 of file assLongMenuTest.php.

147  : void
148  {
149  $obj = new assLongMenu();
150  $obj->setAnswers(array(array(1,2,3,4)));
151  $this->assertEquals($obj->checkQuestionCustomPart(), false);
152  }
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 154 of file assLongMenuTest.php.

154  : void
155  {
156  $obj = new assLongMenu();
157  $obj->setCorrectAnswers(array( 0 => array( 0 => array(0 => 'answer'),1 => '2.25', 2 => '1'),
158  1 => array( 0 => array(0 => 'answer'),1 => '2.25', 2 => '1')));
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_shouldBeFalseBecauseToManyCorrectAnswers()

assLongmenuTest::test_checkQuestionCustomPart_shouldBeFalseBecauseToManyCorrectAnswers ( )

Definition at line 161 of file assLongMenuTest.php.

161  : void
162  {
163  $obj = new assLongMenu();
164  $obj->setCorrectAnswers(array( 0 => array( 0 => array(0 => 'answer'),1 => '2.25', 2 => '1'),
165  1 => array( 0 => array(0 => 'answer'),1 => '2.25', 2 => '1')));
166  $obj->setAnswers(array(array('answer')));
167  $this->assertEquals($obj->checkQuestionCustomPart(), false);
168  }
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 201 of file assLongMenuTest.php.

201  : void
202  {
203  $obj = new assLongMenu();
204  $obj->setCorrectAnswers(array( 0 => array( 0 => array('answer'),1 => 1, 2 => '1')));
205  $obj->setAnswers(array(array('answer')));
206  $this->assertEquals($obj->checkQuestionCustomPart(), true);
207  }
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 92 of file assLongMenuTest.php.

92  : void
93  {
94  $method = self::getMethod('correctAnswerDoesNotExistInAnswerOptions');
95  $obj = new assLongMenu();
96  $value = $method->invokeArgs($obj, array(array(array(1),1,1), array(1,2,3,4)));
97  $this->assertEquals(false, $value);
98  }
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 84 of file assLongMenuTest.php.

84  : void
85  {
86  $method = self::getMethod('correctAnswerDoesNotExistInAnswerOptions');
87  $obj = new assLongMenu();
88  $value = $method->invokeArgs($obj, array(array(array(5),1,1), array(1,2,3,4)));
89  $this->assertEquals(true, $value);
90  }
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 66 of file assLongMenuTest.php.

66  : void
67  {
68  $instance = new assLongMenu();
69  $this->assertEquals('qpl_qst_lome', $instance->getAdditionalTableName());
70  }
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 78 of file assLongMenuTest.php.

78  : void
79  {
80  $instance = new assLongMenu();
81  $this->assertEquals('qpl_a_lome', $instance->getAnswerTableName());
82  }
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 100 of file assLongMenuTest.php.

100  : void
101  {
102  $obj = new assLongMenu();
103  $obj->setCorrectAnswers(array( 0 => array( 0 => array(0 => 'answer'),1 => '2', 2 => '1'),
104  1 => array( 0 => array(0 => 'answer'),1 => '2', 2 => '1')));
105  $value = $obj->getMaximumPoints();
106  $this->assertEquals(4, $value);
107  }
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 109 of file assLongMenuTest.php.

109  : void
110  {
111  $obj = new assLongMenu();
112  $obj->setCorrectAnswers(array( 0 => array( 0 => array(0 => 'answer'),1 => '2.25', 2 => '1'),
113  1 => array( 0 => array(0 => 'answer'),1 => '2.25', 2 => '1')));
114  $value = $obj->getMaximumPoints();
115  $this->assertEquals(4.5, $value);
116  }
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 72 of file assLongMenuTest.php.

72  : void
73  {
74  $instance = new assLongMenu();
75  $this->assertEquals('assLongMenu', $instance->getQuestionType());
76  }
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 209 of file assLongMenuTest.php.

209  : void
210  {
211  $obj = new assLongMenu();
212  $array = array( 0 => 'squirrel', 1 => 'icebear');
213  $_POST['answer'] = $array;
214  $this->assertEquals($obj->getSolutionSubmit(), $array);
215  }
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 60 of file assLongMenuTest.php.

60  : void
61  {
62  $instance = new assLongMenu();
63  $this->assertInstanceOf('assLongMenu', $instance);
64  }
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 118 of file assLongMenuTest.php.

118  : void
119  {
120  $obj = new assLongMenu();
121  $obj->setCorrectAnswers(array( 0 => array( 0 => array(0 => 'answer'),1 => '2.25', 2 => '1'),
122  1 => array( 0 => array(0 => 'answer'),1 => '2.25', 2 => '1')));
123  $obj->setAnswers(array(array(1,2,3,4)));
124  $this->assertEquals($obj->isComplete(), false);
125  }
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 240 of file assLongMenuTest.php.

240  : void
241  {
242  $obj = new assLongMenu();
243  $this->assertEquals(false, $obj->isShuffleAnswersEnabled());
244  $this->assertNotEquals(true, $obj->isShuffleAnswersEnabled());
245  }
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 217 of file assLongMenuTest.php.

217  : void
218  {
219  $obj = new assLongMenu();
220  $obj->setAnswerType([]);
221  $this->assertEquals([], $obj->getAnswerType());
222  }
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 233 of file assLongMenuTest.php.

233  : void
234  {
235  $obj = new assLongMenu();
236  $obj->setJsonStructure(json_encode(array(1 => 'bla')));
237  $this->assertEquals('{"1":"bla"}', $obj->getJsonStructure());
238  }
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: