ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilTestParticipantDataTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
26 {
28 
29  protected function setUp(): void
30  {
31  parent::setUp();
32 
33  $this->testObj = new ilTestParticipantData(
34  $this->createMock(ilDBInterface::class),
35  $this->createMock(ilLanguage::class)
36  );
37  }
38 
40  {
41  $this->assertInstanceOf(ilTestParticipantData::class, $this->testObj);
42  }
43 
44  public function testParticipantAccessFilter(): void
45  {
46  $callback = static function () {
47  return 'Hello';
48  };
49 
50  $this->testObj->setParticipantAccessFilter($callback);
51  $this->assertEquals($callback, $this->testObj->getParticipantAccessFilter());
52  }
53 
54  public function testScoredParticipantsFilterEnabled(): void
55  {
56  $this->testObj->setScoredParticipantsFilterEnabled(false);
57  $this->assertFalse($this->testObj->isScoredParticipantsFilterEnabled());
58 
59  $this->testObj->setScoredParticipantsFilterEnabled(true);
60  $this->assertTrue($this->testObj->isScoredParticipantsFilterEnabled());
61  }
62 
64  {
65  $this->assertEquals('1 = 1', $this->testObj->getScoredParticipantsFilterExpression());
66 
67  $this->testObj->setScoredParticipantsFilterEnabled(true);
68  $this->assertEquals(
69  'ta.last_finished_pass = ta.last_started_pass',
70  $this->testObj->getScoredParticipantsFilterExpression()
71  );
72  }
73 
74  public function testActiveIdsFilter(): void
75  {
76  $expected = [1, 125, 1290];
77  $this->testObj->setActiveIdsFilter($expected);
78  $this->assertEquals($expected, $this->testObj->getActiveIdsFilter());
79  }
80 
81  public function testUserIdsFilter(): void
82  {
83  $expected = [1, 125, 1290];
84  $this->testObj->setUserIdsFilter($expected);
85  $this->assertEquals($expected, $this->testObj->getUserIdsFilter());
86  }
87 
88  public function testAnonymousIdsFilter(): void
89  {
90  $expected = [1, 125, 1290];
91  $this->testObj->setAnonymousIdsFilter($expected);
92  $this->assertEquals($expected, $this->testObj->getAnonymousIdsFilter());
93  }
94 }
Class ilTestParticipantDataTest.