ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilTestParticipantListTest Class Reference

Class ilTestParticipantListTest. More...

+ Inheritance diagram for ilTestParticipantListTest:
+ Collaboration diagram for ilTestParticipantListTest:

Public Member Functions

 test_instantiateObject_shouldReturnInstance ()
 
 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_ilRbacAdmin ()
 
 addGlobal_ilCtrl ()
 
 addGlobal_lng ()
 
 addGlobal_filesystem ()
 
 addGlobal_upload ()
 
 addGlobal_ilDB ()
 
 addGlobal_ilBench ()
 
 addGlobal_ilLog ()
 
 addGlobal_ilias ()
 
 addGlobal_ilErr ()
 
 addGlobal_GlobalScreenService ()
 
 addGlobal_ilNavigationHistory ()
 
 addGlobal_ilAppEventHandler ()
 
 addGlobal_tpl ()
 
 addGlobal_ilComponentRepository ()
 
 addGlobal_ilComponentFactory ()
 
 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 ()
 
 addGlobal_skillService ()
 
 addGlobal_objectService ()
 
 addGlobal_resourceStorage ()
 
 getTestObjMock ()
 

Private Attributes

ilTestParticipantList $testObj
 

Additional Inherited Members

- Protected Attributes inherited from ilTestBaseTestCase
Container $dic = null
 

Detailed Description

Member Function Documentation

◆ setUp()

ilTestParticipantListTest::setUp ( )
protected

Definition at line 29 of file ilTestParticipantListTest.php.

References $DIC, ilTestBaseTestCase\addGlobal_ilUser(), and ilTestBaseTestCase\addGlobal_lng().

29  : void
30  {
31  global $DIC;
32  parent::setUp();
33 
34  $this->addGlobal_ilUser();
35  $this->addGlobal_lng();
36 
37  $this->testObj = new ilTestParticipantList(
38  $this->createMock(ilObjTest::class),
39  $DIC['ilUser'],
40  $DIC['lng'],
41  $DIC['ilDB']
42  );
43  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

◆ test_instantiateObject_shouldReturnInstance()

ilTestParticipantListTest::test_instantiateObject_shouldReturnInstance ( )

Definition at line 45 of file ilTestParticipantListTest.php.

45  : void
46  {
47  $this->assertInstanceOf(ilTestParticipantList::class, $this->testObj);
48  }

◆ testAddParticipant()

ilTestParticipantListTest::testAddParticipant ( )

Definition at line 50 of file ilTestParticipantListTest.php.

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

◆ testCurrent()

ilTestParticipantListTest::testCurrent ( )

Definition at line 170 of file ilTestParticipantListTest.php.

References $id.

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

◆ testGetAccessFilteredList()

ilTestParticipantListTest::testGetAccessFilteredList ( )

Definition at line 136 of file ilTestParticipantListTest.php.

References $id.

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

◆ testGetAllActiveIds()

ilTestParticipantListTest::testGetAllActiveIds ( )

Definition at line 99 of file ilTestParticipantListTest.php.

References $id.

99  : void
100  {
101  $ids = [
102  12,
103  125,
104  176,
105  12111,
106  1
107  ];
108 
109  foreach ($ids as $id) {
110  $participant = new ilTestParticipant();
111  $participant->setActiveId($id);
112  $this->testObj->addParticipant($participant);
113  }
114  $this->assertEquals($ids, $this->testObj->getAllActiveIds());
115  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ testGetAllUserIds()

ilTestParticipantListTest::testGetAllUserIds ( )

Definition at line 81 of file ilTestParticipantListTest.php.

References $id.

81  : void
82  {
83  $ids = [
84  12,
85  125,
86  176,
87  12111,
88  1
89  ];
90 
91  foreach ($ids as $id) {
92  $participant = new ilTestParticipant();
93  $participant->setUsrId($id);
94  $this->testObj->addParticipant($participant);
95  }
96  $this->assertEquals($ids, $this->testObj->getAllUserIds());
97  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ testGetParticipantByUsrId()

ilTestParticipantListTest::testGetParticipantByUsrId ( )

Definition at line 58 of file ilTestParticipantListTest.php.

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

◆ testHasUnfinishedPasses()

ilTestParticipantListTest::testHasUnfinishedPasses ( )

Definition at line 66 of file ilTestParticipantListTest.php.

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

◆ testIsActiveIdInList()

ilTestParticipantListTest::testIsActiveIdInList ( )

Definition at line 117 of file ilTestParticipantListTest.php.

References $id.

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

◆ testKey()

ilTestParticipantListTest::testKey ( )

Definition at line 210 of file ilTestParticipantListTest.php.

References $id.

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

◆ testNext()

ilTestParticipantListTest::testNext ( )

Definition at line 190 of file ilTestParticipantListTest.php.

References $id.

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

◆ testRewind()

ilTestParticipantListTest::testRewind ( )

Definition at line 252 of file ilTestParticipantListTest.php.

References $id.

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

◆ testValid()

ilTestParticipantListTest::testValid ( )

Definition at line 230 of file ilTestParticipantListTest.php.

References $id.

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

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: