19 declare(strict_types=1);
29 protected function setUp(): void
34 $this->addGlobal_ilUser();
37 $this->getTestObjMock(),
46 $this->assertInstanceOf(ilTestParticipantList::class, $this->testObj);
53 $participant->setActiveId($activeId);
54 $this->testObj->addParticipant($participant);
55 $this->assertEquals($participant, $this->testObj->getParticipantByActiveId($activeId));
62 $participant->setUsrId($usr_id);
63 $this->testObj->addParticipant($participant);
64 $this->assertEquals($participant, $this->testObj->getParticipantByUsrId($usr_id));
70 $participant->setUnfinishedPasses(
false);
71 $this->testObj->addParticipant($participant);
73 $this->assertFalse($this->testObj->hasUnfinishedPasses());
76 $participant->setUnfinishedPasses(
true);
77 $this->testObj->addParticipant($participant);
79 $this->assertTrue($this->testObj->hasUnfinishedPasses());
92 foreach ($ids as
$id) {
94 $participant->setUsrId($id);
95 $this->testObj->addParticipant($participant);
97 $this->assertEquals($ids, $this->testObj->getAllUserIds());
110 foreach ($ids as
$id) {
112 $participant->setActiveId($id);
113 $this->testObj->addParticipant($participant);
115 $this->assertEquals($ids, $this->testObj->getAllActiveIds());
128 foreach ($ids as
$id) {
130 $participant->setActiveId($id);
131 $this->testObj->addParticipant($participant);
133 $this->assertTrue($this->testObj->isActiveIdInList($id));
135 $this->assertFalse($this->testObj->isActiveIdInList(PHP_INT_MAX));
154 foreach ($ids as
$id) {
156 $participant->setUsrId($id);
157 $this->testObj->addParticipant($participant);
160 $callback =
static function ($userIds) use ($expected) {
164 foreach ($expected as $value) {
165 $this->assertInstanceOf(ilTestParticipant::class, $this->testObj->getAccessFilteredList($callback)->getParticipantByUsrId($value));
177 foreach ($ids as
$id) {
179 $participant->setUsrId($id);
180 $this->testObj->addParticipant($participant);
183 if (isset($ids[0])) {
184 $this->assertEquals($ids[0], $this->testObj->current()->getUsrId());
186 $this->assertTrue(
false);
198 foreach ($ids as
$id) {
200 $participant->setUsrId($id);
201 $this->testObj->addParticipant($participant);
204 $countIds = count($ids);
206 for ($i = 1; $i < $countIds; $i++) {
207 $this->testObj->next();
210 $this->assertEquals($ids[--$countIds], $this->testObj->current()->getUsrId());
222 foreach ($ids as $key =>
$id) {
224 $participant->setUsrId(
$id);
225 $this->testObj->addParticipant($participant);
227 $this->assertEquals($key, $this->testObj->key());
228 $this->testObj->next();
240 foreach ($ids as
$id) {
242 $participant->setUsrId($id);
243 $this->testObj->addParticipant($participant);
246 for ($i = 0, $iMax = count($ids) - 1; $i < $iMax; $i++) {
247 $this->testObj->next();
249 $this->assertTrue($this->testObj->valid());
251 $this->testObj->next();
252 $this->assertFalse($this->testObj->valid());
263 foreach ($ids as
$id) {
265 $participant->setUsrId($id);
266 $this->testObj->addParticipant($participant);
269 $countIds = count($ids);
271 for ($i = 1; $i < $countIds; $i++) {
272 $this->testObj->next();
274 $this->assertTrue($this->testObj->valid());
276 $this->testObj->rewind();
277 $this->assertEquals($ids[0], $this->testObj->current()->getUsrId());
279 $this->assertTrue(
false);
testGetParticipantByUsrId()
testHasUnfinishedPasses()
Class ilTestParticipantListTest.
test_instantiateObject_shouldReturnInstance()
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
ilTestParticipantList $testObj
testGetAccessFilteredList()