ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTestRandomQuestionSetQuestionCollectionTest 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 ilTestRandomQuestionSetQuestionCollectionTest:
+ Collaboration diagram for ilTestRandomQuestionSetQuestionCollectionTest:

Public Member Functions

 test_instantiateObject_shouldReturnInstance ()
 
 testQuestions ()
 
 testAddQuestions ()
 
 testCurrent ()
 
 testNext ()
 
 testKey ()
 
 testValid ()
 
 testRewind ()
 
 testIsGreaterThan ()
 
 testIsSmallerThan ()
 
 testGetMissingCount ()
 
 testMergeQuestionCollection ()
 
 testGetUniqueQuestionCollection ()
 
 testGetQuestionAmount ()
 
 testGetInvolvedQuestionIds ()
 

Protected Member Functions

 setUp ()
 
- Protected Member Functions inherited from ilTestBaseTestCase
 setUp ()
 
 tearDown ()
 
 setGlobalVariable (string $name, $value)
 
 getGlobalTemplateMock ()
 
 getDatabaseMock ()
 
 getIliasMock ()
 
 addGlobal_ilAccess ()
 
 addGlobal_ilUser ()
 
 addGlobal_objDefinition ()
 
 addGlobal_tree ()
 
 addGlobal_ilSetting ()
 
 addGlobal_rbacsystem ()
 
 addGlobal_ilCtrl ()
 
 addGlobal_lng ()
 
 addGlobal_filesystem ()
 
 addGlobal_upload ()
 
 addGlobal_ilDB ()
 
 addGlobal_ilLog ()
 
 addGlobal_ilias ()
 
 addGlobal_ilErr ()
 
 addGlobal_ilAppEventHandler ()
 
 addGlobal_tpl ()
 
 addGlobal_ilComponentRepository ()
 
 addGlobal_ilTabs ()
 
 addGlobal_ilObjDataCache ()
 
 addGlobal_ilLocator ()
 
 addGlobal_rbacreview ()
 
 addGlobal_ilToolbar ()
 
 addGlobal_http ()
 
 addGlobal_ilIliasIniFile ()
 
 addGlobal_ilLoggerFactory ()
 
 addGlobal_ilHelp ()
 
 addGlobal_ui ()
 
 addGlobal_uiFactory ()
 
 addGlobal_uiRenderer ()
 
 addGlobal_refinery ()
 

Private Attributes

ilTestRandomQuestionSetQuestionCollection $testObj
 

Additional Inherited Members

- Protected Attributes inherited from ilTestBaseTestCase
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 Class ilTestRandomQuestionSetQuestionCollectionTest

Author
Marvin Beym mbeym.nosp@m.@dat.nosp@m.abay..nosp@m.de

Definition at line 25 of file ilTestRandomQuestionSetQuestionCollectionTest.php.

Member Function Documentation

◆ setUp()

ilTestRandomQuestionSetQuestionCollectionTest::setUp ( )
protected

Definition at line 29 of file ilTestRandomQuestionSetQuestionCollectionTest.php.

29  : void
30  {
31  parent::setUp();
32 
33  $this->testObj = new ilTestRandomQuestionSetQuestionCollection();
34  }

◆ test_instantiateObject_shouldReturnInstance()

ilTestRandomQuestionSetQuestionCollectionTest::test_instantiateObject_shouldReturnInstance ( )

Definition at line 36 of file ilTestRandomQuestionSetQuestionCollectionTest.php.

36  : void
37  {
38  $this->assertInstanceOf(ilTestRandomQuestionSetQuestionCollection::class, $this->testObj);
39  }

◆ testAddQuestions()

ilTestRandomQuestionSetQuestionCollectionTest::testAddQuestions ( )

Definition at line 52 of file ilTestRandomQuestionSetQuestionCollectionTest.php.

52  : void
53  {
54  $this->testObj->addQuestion(new ilTestRandomQuestionSetQuestion());
55  $this->testObj->addQuestion(new ilTestRandomQuestionSetQuestion());
56  $this->testObj->addQuestion(new ilTestRandomQuestionSetQuestion());
57  $this->assertCount(3, $this->testObj->getQuestions());
58  }

◆ testCurrent()

ilTestRandomQuestionSetQuestionCollectionTest::testCurrent ( )

Definition at line 60 of file ilTestRandomQuestionSetQuestionCollectionTest.php.

References $id.

60  : void
61  {
62  $questions = [];
63  $ids = [125, 112, 10];
64  foreach ($ids as $id) {
65  $question = new ilTestRandomQuestionSetQuestion();
66  $question->setQuestionId($id);
67  $questions[] = $question;
68  }
69 
70  $this->testObj->setQuestions($questions);
71 
72  $this->assertEquals($questions[0], $this->testObj->current());
73  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ testGetInvolvedQuestionIds()

ilTestRandomQuestionSetQuestionCollectionTest::testGetInvolvedQuestionIds ( )

Definition at line 250 of file ilTestRandomQuestionSetQuestionCollectionTest.php.

References $id.

250  : void
251  {
252  $ids = [125, 112, 10];
253  foreach ($ids as $id) {
254  $question = new ilTestRandomQuestionSetQuestion();
255  $question->setQuestionId($id);
256  $this->testObj->addQuestion($question);
257  }
258 
259  $this->assertEquals($ids, $this->testObj->getInvolvedQuestionIds());
260  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ testGetMissingCount()

ilTestRandomQuestionSetQuestionCollectionTest::testGetMissingCount ( )

Definition at line 183 of file ilTestRandomQuestionSetQuestionCollectionTest.php.

References $id.

183  : void
184  {
185  $questions = [];
186  $ids = [125, 112, 10];
187  foreach ($ids as $id) {
188  $question = new ilTestRandomQuestionSetQuestion();
189  $question->setQuestionId($id);
190  $questions[] = $question;
191  }
192 
193  $this->testObj->setQuestions($questions);
194 
195  $this->assertEquals(0, $this->testObj->getMissingCount(3));
196  $this->assertEquals(0, $this->testObj->getMissingCount(1));
197  $this->assertEquals(3, $this->testObj->getMissingCount(6));
198  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ testGetQuestionAmount()

ilTestRandomQuestionSetQuestionCollectionTest::testGetQuestionAmount ( )

Definition at line 238 of file ilTestRandomQuestionSetQuestionCollectionTest.php.

References $id.

238  : void
239  {
240  $ids = [125, 112, 10];
241  foreach ($ids as $id) {
242  $question = new ilTestRandomQuestionSetQuestion();
243  $question->setQuestionId($id);
244  $this->testObj->addQuestion($question);
245  }
246 
247  $this->assertEquals(3, $this->testObj->getQuestionAmount());
248  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ testGetUniqueQuestionCollection()

ilTestRandomQuestionSetQuestionCollectionTest::testGetUniqueQuestionCollection ( )

Definition at line 226 of file ilTestRandomQuestionSetQuestionCollectionTest.php.

References $id.

226  : void
227  {
228  $ids = [125, 112, 10, 112];
229  foreach ($ids as $id) {
230  $question = new ilTestRandomQuestionSetQuestion();
231  $question->setQuestionId($id);
232  $this->testObj->addQuestion($question);
233  }
234 
235  $this->assertCount(3, $this->testObj->getUniqueQuestionCollection()->getQuestions());
236  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ testIsGreaterThan()

ilTestRandomQuestionSetQuestionCollectionTest::testIsGreaterThan ( )

Definition at line 149 of file ilTestRandomQuestionSetQuestionCollectionTest.php.

References $id.

149  : void
150  {
151  $questions = [];
152  $ids = [125, 112, 10];
153  foreach ($ids as $id) {
154  $question = new ilTestRandomQuestionSetQuestion();
155  $question->setQuestionId($id);
156  $questions[] = $question;
157  }
158 
159  $this->testObj->setQuestions($questions);
160 
161  $this->assertTrue($this->testObj->isGreaterThan(2));
162  $this->assertTrue($this->testObj->isGreaterThan(1));
163  $this->assertFalse($this->testObj->isGreaterThan(6));
164  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ testIsSmallerThan()

ilTestRandomQuestionSetQuestionCollectionTest::testIsSmallerThan ( )

Definition at line 166 of file ilTestRandomQuestionSetQuestionCollectionTest.php.

References $id.

166  : void
167  {
168  $questions = [];
169  $ids = [125, 112, 10];
170  foreach ($ids as $id) {
171  $question = new ilTestRandomQuestionSetQuestion();
172  $question->setQuestionId($id);
173  $questions[] = $question;
174  }
175 
176  $this->testObj->setQuestions($questions);
177 
178  $this->assertFalse($this->testObj->isSmallerThan(3));
179  $this->assertFalse($this->testObj->isSmallerThan(1));
180  $this->assertTrue($this->testObj->isSmallerThan(6));
181  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ testKey()

ilTestRandomQuestionSetQuestionCollectionTest::testKey ( )

Definition at line 90 of file ilTestRandomQuestionSetQuestionCollectionTest.php.

References $id.

90  : void
91  {
92  $questions = [];
93  $ids = [125, 112, 10];
94  foreach ($ids as $id) {
95  $question = new ilTestRandomQuestionSetQuestion();
96  $question->setQuestionId($id);
97  $questions[] = $question;
98  }
99 
100  $this->testObj->setQuestions($questions);
101 
102  $this->assertEquals(0, $this->testObj->key());
103 
104  $this->testObj->next();
105  $this->testObj->next();
106  $this->assertEquals(2, $this->testObj->key());
107  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ testMergeQuestionCollection()

ilTestRandomQuestionSetQuestionCollectionTest::testMergeQuestionCollection ( )

Definition at line 200 of file ilTestRandomQuestionSetQuestionCollectionTest.php.

References $id, and $index.

200  : void
201  {
202  $questions = [];
203  $ids = [125, 112, 10];
204  foreach ($ids as $index => $id) {
205  $question = new ilTestRandomQuestionSetQuestion();
206  $question->setQuestionId($id);
207  $questions[$index] = $question;
208  $this->testObj->addQuestion($question);
209  }
210 
211  $collection = new ilTestRandomQuestionSetQuestionCollection();
212 
213  $ids = [1, 5, 8];
214  foreach ($ids as $index => $id) {
215  $question = new ilTestRandomQuestionSetQuestion();
216  $question->setQuestionId($id);
217  $questions[$index + 3] = $question;
218  $collection->addQuestion($question);
219  }
220 
221  $this->testObj->mergeQuestionCollection($collection);
222 
223  $this->assertEquals($questions, $this->testObj->getQuestions());
224  }
$index
Definition: metadata.php:145
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ testNext()

ilTestRandomQuestionSetQuestionCollectionTest::testNext ( )

Definition at line 75 of file ilTestRandomQuestionSetQuestionCollectionTest.php.

References $id.

75  : void
76  {
77  $questions = [];
78  $ids = [125, 112, 10];
79  foreach ($ids as $id) {
80  $question = new ilTestRandomQuestionSetQuestion();
81  $question->setQuestionId($id);
82  $questions[] = $question;
83  }
84 
85  $this->testObj->setQuestions($questions);
86 
87  $this->assertEquals($questions[1], $this->testObj->next());
88  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ testQuestions()

ilTestRandomQuestionSetQuestionCollectionTest::testQuestions ( )

Definition at line 41 of file ilTestRandomQuestionSetQuestionCollectionTest.php.

41  : void
42  {
43  $expected = [
46  ];
47 
48  $this->testObj->setQuestions($expected);
49  $this->assertEquals($expected, $this->testObj->getQuestions());
50  }

◆ testRewind()

ilTestRandomQuestionSetQuestionCollectionTest::testRewind ( )

Definition at line 127 of file ilTestRandomQuestionSetQuestionCollectionTest.php.

References $id.

127  : void
128  {
129  $questions = [];
130  $ids = [125, 112, 10];
131  foreach ($ids as $id) {
132  $question = new ilTestRandomQuestionSetQuestion();
133  $question->setQuestionId($id);
134  $questions[] = $question;
135  }
136 
137  $this->testObj->setQuestions($questions);
138 
139  $this->assertEquals($questions[0], $this->testObj->current());
140 
141  $this->testObj->next();
142  $this->testObj->next();
143  $this->assertEquals($questions[2], $this->testObj->current());
144 
145  $this->testObj->rewind();
146  $this->assertEquals($questions[0], $this->testObj->current());
147  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ testValid()

ilTestRandomQuestionSetQuestionCollectionTest::testValid ( )

Definition at line 109 of file ilTestRandomQuestionSetQuestionCollectionTest.php.

References $id.

109  : void
110  {
111  $questions = [];
112  $ids = [125, 112, 10];
113  foreach ($ids as $id) {
114  $question = new ilTestRandomQuestionSetQuestion();
115  $question->setQuestionId($id);
116  $questions[] = $question;
117  }
118 
119  $this->testObj->setQuestions($questions);
120 
121  $this->assertTrue($this->testObj->valid());
122 
123  $this->testObj->setQuestions([]);
124  $this->assertFalse($this->testObj->valid());
125  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

Field Documentation

◆ $testObj

ilTestRandomQuestionSetQuestionCollection ilTestRandomQuestionSetQuestionCollectionTest::$testObj
private

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