Class ilTestParticipantListTest.
More...
◆ setUp()
ilTestParticipantListTest::setUp |
( |
| ) |
|
|
protected |
◆ test_instantiateObject_shouldReturnInstance()
ilTestParticipantListTest::test_instantiateObject_shouldReturnInstance |
( |
| ) |
|
◆ testAddParticipant()
ilTestParticipantListTest::testAddParticipant |
( |
| ) |
|
Definition at line 49 of file ilTestParticipantListTest.php.
49 : void
50 {
51 $activeId = 22;
53 $participant->setActiveId($activeId);
54 $this->testObj->addParticipant($participant);
55 $this->assertEquals($participant, $this->testObj->getParticipantByActiveId($activeId));
56 }
◆ testCurrent()
ilTestParticipantListTest::testCurrent |
( |
| ) |
|
Definition at line 169 of file ilTestParticipantListTest.php.
169 : void
170 {
171 $ids = [
172 12,
173 125,
174 176
175 ];
176
177 foreach ($ids as
$id) {
179 $participant->setUsrId(
$id);
180 $this->testObj->addParticipant($participant);
181 }
182
183 if (isset($ids[0])) {
184 $this->assertEquals($ids[0], $this->testObj->current()->getUsrId());
185 } else {
186 $this->assertTrue(false);
187 }
188 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
References $id.
◆ testGetAccessFilteredList()
ilTestParticipantListTest::testGetAccessFilteredList |
( |
| ) |
|
Definition at line 138 of file ilTestParticipantListTest.php.
138 : void
139 {
140 $ids = [
141 12,
142 125,
143 176,
144 12111,
145 1
146 ];
147
148 $expected = [
149 12,
150 125,
151 176
152 ];
153
154 foreach ($ids as
$id) {
156 $participant->setUsrId(
$id);
157 $this->testObj->addParticipant($participant);
158 }
159
160 $callback = static function ($userIds) use ($expected) {
161 return $expected;
162 };
163
164 foreach ($expected as $value) {
165 $this->assertInstanceOf(ilTestParticipant::class, $this->testObj->getAccessFilteredList($callback)->getParticipantByUsrId($value));
166 }
167 }
References $id.
◆ testGetAllActiveIds()
ilTestParticipantListTest::testGetAllActiveIds |
( |
| ) |
|
Definition at line 100 of file ilTestParticipantListTest.php.
100 : void
101 {
102 $ids = [
103 12,
104 125,
105 176,
106 12111,
107 1
108 ];
109
110 foreach ($ids as
$id) {
112 $participant->setActiveId(
$id);
113 $this->testObj->addParticipant($participant);
114 }
115 $this->assertEquals($ids, $this->testObj->getAllActiveIds());
116 }
References $id.
◆ testGetAllUserIds()
ilTestParticipantListTest::testGetAllUserIds |
( |
| ) |
|
Definition at line 82 of file ilTestParticipantListTest.php.
82 : void
83 {
84 $ids = [
85 12,
86 125,
87 176,
88 12111,
89 1
90 ];
91
92 foreach ($ids as
$id) {
94 $participant->setUsrId(
$id);
95 $this->testObj->addParticipant($participant);
96 }
97 $this->assertEquals($ids, $this->testObj->getAllUserIds());
98 }
References $id.
◆ testGetParticipantByUsrId()
ilTestParticipantListTest::testGetParticipantByUsrId |
( |
| ) |
|
Definition at line 58 of file ilTestParticipantListTest.php.
58 : void
59 {
60 $usr_id = 125;
62 $participant->setUsrId($usr_id);
63 $this->testObj->addParticipant($participant);
64 $this->assertEquals($participant, $this->testObj->getParticipantByUsrId($usr_id));
65 }
◆ testHasUnfinishedPasses()
ilTestParticipantListTest::testHasUnfinishedPasses |
( |
| ) |
|
Definition at line 67 of file ilTestParticipantListTest.php.
67 : void
68 {
70 $participant->setUnfinishedPasses(false);
71 $this->testObj->addParticipant($participant);
72
73 $this->assertFalse($this->testObj->hasUnfinishedPasses());
74
76 $participant->setUnfinishedPasses(true);
77 $this->testObj->addParticipant($participant);
78
79 $this->assertTrue($this->testObj->hasUnfinishedPasses());
80 }
◆ testIsActiveIdInList()
ilTestParticipantListTest::testIsActiveIdInList |
( |
| ) |
|
Definition at line 118 of file ilTestParticipantListTest.php.
118 : void
119 {
120 $ids = [
121 12,
122 125,
123 176,
124 12111,
125 1
126 ];
127
128 foreach ($ids as
$id) {
130 $participant->setActiveId(
$id);
131 $this->testObj->addParticipant($participant);
132
133 $this->assertTrue($this->testObj->isActiveIdInList(
$id));
134 }
135 $this->assertFalse($this->testObj->isActiveIdInList(PHP_INT_MAX));
136 }
References $id.
◆ testKey()
ilTestParticipantListTest::testKey |
( |
| ) |
|
Definition at line 214 of file ilTestParticipantListTest.php.
214 : void
215 {
216 $ids = [
217 12,
218 125,
219 176
220 ];
221
222 foreach ($ids as $key =>
$id) {
224 $participant->setUsrId(
$id);
225 $this->testObj->addParticipant($participant);
226
227 $this->assertEquals($key, $this->testObj->key());
228 $this->testObj->next();
229 }
230 }
References $id.
◆ testNext()
ilTestParticipantListTest::testNext |
( |
| ) |
|
Definition at line 190 of file ilTestParticipantListTest.php.
190 : void
191 {
192 $ids = [
193 12,
194 125,
195 176
196 ];
197
198 foreach ($ids as
$id) {
200 $participant->setUsrId(
$id);
201 $this->testObj->addParticipant($participant);
202 }
203
204 $countIds = count($ids);
205 if ($countIds > 0) {
206 for ($i = 1; $i < $countIds; $i++) {
207 $this->testObj->next();
208 }
209
210 $this->assertEquals($ids[--$countIds], $this->testObj->current()->getUsrId());
211 }
212 }
References $id.
◆ testRewind()
ilTestParticipantListTest::testRewind |
( |
| ) |
|
Definition at line 255 of file ilTestParticipantListTest.php.
255 : void
256 {
257 $ids = [
258 12,
259 125,
260 176
261 ];
262
263 foreach ($ids as
$id) {
265 $participant->setUsrId(
$id);
266 $this->testObj->addParticipant($participant);
267 }
268
269 $countIds = count($ids);
270 if ($countIds > 0) {
271 for ($i = 1; $i < $countIds; $i++) {
272 $this->testObj->next();
273 }
274 $this->assertTrue($this->testObj->valid());
275
276 $this->testObj->rewind();
277 $this->assertEquals($ids[0], $this->testObj->current()->getUsrId());
278 } else {
279 $this->assertTrue(false);
280 }
281 }
References $id.
◆ testValid()
ilTestParticipantListTest::testValid |
( |
| ) |
|
Definition at line 232 of file ilTestParticipantListTest.php.
232 : void
233 {
234 $ids = [
235 12,
236 125,
237 176
238 ];
239
240 foreach ($ids as
$id) {
242 $participant->setUsrId(
$id);
243 $this->testObj->addParticipant($participant);
244 }
245
246 for ($i = 0, $iMax = count($ids) - 1; $i < $iMax; $i++) {
247 $this->testObj->next();
248 }
249 $this->assertTrue($this->testObj->valid());
250
251 $this->testObj->next();
252 $this->assertFalse($this->testObj->valid());
253 }
References $id.
◆ $testObj
The documentation for this class was generated from the following file: