ILIAS  release_8 Revision v8.24
ilTestParticipantListTest 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 ilTestParticipantListTest:
+ Collaboration diagram for ilTestParticipantListTest:

Public Member Functions

 test_instantiateObject_shouldReturnInstance ()
 
 testTestObj ()
 
 testAddParticipant ()
 
 testGetParticipantByUsrId ()
 
 testHasUnfinishedPasses ()
 
 testGetAllUserIds ()
 
 testGetAllActiveIds ()
 
 testIsActiveIdInList ()
 
 testGetAccessFilteredList ()
 
 testCurrent ()
 
 testNext ()
 
 testKey ()
 
 testValid ()
 
 testRewind ()
 

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

ilTestParticipantList $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 ilTestParticipantListTest

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

Definition at line 25 of file ilTestParticipantListTest.php.

Member Function Documentation

◆ setUp()

ilTestParticipantListTest::setUp ( )
protected

Reimplemented from ilTestBaseTestCase.

Definition at line 29 of file ilTestParticipantListTest.php.

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

◆ test_instantiateObject_shouldReturnInstance()

ilTestParticipantListTest::test_instantiateObject_shouldReturnInstance ( )

Definition at line 36 of file ilTestParticipantListTest.php.

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

◆ testAddParticipant()

ilTestParticipantListTest::testAddParticipant ( )

Definition at line 48 of file ilTestParticipantListTest.php.

48 : void
49 {
50 $participant = new ilTestParticipant();
51 $participant->setActiveId(22);
52 $this->testObj->addParticipant($participant);
53 $this->assertEquals($participant, $this->testObj->getParticipantByActiveId(22));
54 }

◆ testCurrent()

ilTestParticipantListTest::testCurrent ( )

Definition at line 168 of file ilTestParticipantListTest.php.

168 : void
169 {
170 $ids = [
171 12,
172 125,
173 176,
174 ];
175
176 foreach ($ids as $id) {
177 $participant = new ilTestParticipant();
178 $participant->setUsrId($id);
179 $this->testObj->addParticipant($participant);
180 }
181
182 $this->assertEquals($ids[0], $this->testObj->current()->getUsrId());
183
184 $this->testObj->next();
185 $this->assertEquals($ids[1], $this->testObj->current()->getUsrId());
186 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id.

◆ testGetAccessFilteredList()

ilTestParticipantListTest::testGetAccessFilteredList ( )

Definition at line 134 of file ilTestParticipantListTest.php.

134 : void
135 {
136 $ids = [
137 12,
138 125,
139 176,
140 12111,
141 1
142 ];
143
144 $expected = [
145 12,
146 125,
147 176,
148 ];
149
150 foreach ($ids as $id) {
151 $participant = new ilTestParticipant();
152 $participant->setUsrId($id);
153 $this->testObj->addParticipant($participant);
154 }
155
156 $callback = static function ($userIds) use ($expected) {
157 return $expected;
158 };
159
160 $result = $this->testObj->getAccessFilteredList($callback);
161
162 $this->assertNotNull($result->getParticipantByUsrId(12));
163 $this->assertNotNull($result->getParticipantByUsrId(125));
164 $this->assertNotNull($result->getParticipantByUsrId(176));
165 $this->assertNull($result->getParticipantByUsrId(212121));
166 }

References $id.

◆ testGetAllActiveIds()

ilTestParticipantListTest::testGetAllActiveIds ( )

Definition at line 97 of file ilTestParticipantListTest.php.

97 : void
98 {
99 $ids = [
100 12,
101 125,
102 176,
103 12111,
104 1
105 ];
106
107 foreach ($ids as $id) {
108 $participant = new ilTestParticipant();
109 $participant->setActiveId($id);
110 $this->testObj->addParticipant($participant);
111 }
112 $this->assertEquals($ids, $this->testObj->getAllActiveIds());
113 }

References $id.

◆ testGetAllUserIds()

ilTestParticipantListTest::testGetAllUserIds ( )

Definition at line 79 of file ilTestParticipantListTest.php.

79 : void
80 {
81 $ids = [
82 12,
83 125,
84 176,
85 12111,
86 1
87 ];
88
89 foreach ($ids as $id) {
90 $participant = new ilTestParticipant();
91 $participant->setUsrId($id);
92 $this->testObj->addParticipant($participant);
93 }
94 $this->assertEquals($ids, $this->testObj->getAllUserIds());
95 }

References $id.

◆ testGetParticipantByUsrId()

ilTestParticipantListTest::testGetParticipantByUsrId ( )

Definition at line 56 of file ilTestParticipantListTest.php.

56 : void
57 {
58 $participant = new ilTestParticipant();
59 $participant->setUsrId(125);
60 $this->testObj->addParticipant($participant);
61 $this->assertEquals($participant, $this->testObj->getParticipantByUsrId(125));
62 }

◆ testHasUnfinishedPasses()

ilTestParticipantListTest::testHasUnfinishedPasses ( )

Definition at line 64 of file ilTestParticipantListTest.php.

64 : void
65 {
66 $participant = new ilTestParticipant();
67 $participant->setUnfinishedPasses(false);
68 $this->testObj->addParticipant($participant);
69
70 $this->assertFalse($this->testObj->hasUnfinishedPasses());
71
72 $participant = new ilTestParticipant();
73 $participant->setUnfinishedPasses(true);
74 $this->testObj->addParticipant($participant);
75
76 $this->assertTrue($this->testObj->hasUnfinishedPasses());
77 }

◆ testIsActiveIdInList()

ilTestParticipantListTest::testIsActiveIdInList ( )

Definition at line 115 of file ilTestParticipantListTest.php.

115 : void
116 {
117 $ids = [
118 12,
119 125,
120 176,
121 12111,
122 1
123 ];
124
125 foreach ($ids as $id) {
126 $participant = new ilTestParticipant();
127 $participant->setActiveId($id);
128 $this->testObj->addParticipant($participant);
129 }
130 $this->assertTrue($this->testObj->isActiveIdInList(12));
131 $this->assertFalse($this->testObj->isActiveIdInList(222222));
132 }

References $id.

◆ testKey()

ilTestParticipantListTest::testKey ( )

Definition at line 208 of file ilTestParticipantListTest.php.

208 : void
209 {
210 $ids = [
211 12,
212 125,
213 176,
214 ];
215
216 foreach ($ids as $id) {
217 $participant = new ilTestParticipant();
218 $participant->setUsrId($id);
219 $this->testObj->addParticipant($participant);
220 }
221
222 $this->testObj->next();
223 $this->testObj->next();
224
225 $this->assertEquals(2, $this->testObj->key());
226 }

References $id.

◆ testNext()

ilTestParticipantListTest::testNext ( )

Definition at line 188 of file ilTestParticipantListTest.php.

188 : void
189 {
190 $ids = [
191 12,
192 125,
193 176,
194 ];
195
196 foreach ($ids as $id) {
197 $participant = new ilTestParticipant();
198 $participant->setUsrId($id);
199 $this->testObj->addParticipant($participant);
200 }
201
202 $this->testObj->next();
203 $this->testObj->next();
204
205 $this->assertEquals($ids[2], $this->testObj->current()->getUsrId());
206 }

References $id.

◆ testRewind()

ilTestParticipantListTest::testRewind ( )

Definition at line 250 of file ilTestParticipantListTest.php.

250 : void
251 {
252 $ids = [
253 12,
254 125,
255 176,
256 ];
257
258 foreach ($ids as $id) {
259 $participant = new ilTestParticipant();
260 $participant->setUsrId($id);
261 $this->testObj->addParticipant($participant);
262 }
263
264 $this->testObj->next();
265 $this->testObj->next();
266 $this->assertEquals($ids[2], $this->testObj->current()->getUsrId());
267
268 $this->testObj->rewind();
269 $this->assertEquals($ids[0], $this->testObj->current()->getUsrId());
270 }

References $id.

◆ testTestObj()

ilTestParticipantListTest::testTestObj ( )

Definition at line 41 of file ilTestParticipantListTest.php.

41 : void
42 {
43 $objTest_mock = $this->createMock(ilObjTest::class);
44 $this->testObj->setTestObj($objTest_mock);
45 $this->assertEquals($objTest_mock, $this->testObj->getTestObj());
46 }

◆ testValid()

ilTestParticipantListTest::testValid ( )

Definition at line 228 of file ilTestParticipantListTest.php.

228 : void
229 {
230 $ids = [
231 12,
232 125,
233 176,
234 ];
235
236 foreach ($ids as $id) {
237 $participant = new ilTestParticipant();
238 $participant->setUsrId($id);
239 $this->testObj->addParticipant($participant);
240 }
241
242 $this->testObj->next();
243 $this->testObj->next();
244 $this->assertTrue($this->testObj->valid());
245
246 $this->testObj->next();
247 $this->assertFalse($this->testObj->valid());
248 }

References $id.

Field Documentation

◆ $testObj

ilTestParticipantList ilTestParticipantListTest::$testObj
private

Definition at line 27 of file ilTestParticipantListTest.php.


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