ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilTestParticipantsTableGUITest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
26 {
29 
30  protected function setUp(): void
31  {
32  global $DIC;
33  parent::setUp();
34 
35  $this->addGlobal_lng();
36  $this->addGlobal_uiFactory();
37  $this->addGlobal_uiRenderer();
38  $this->addGlobal_tpl();
40 
41  $ctrl_mock = $this->createMock(ilCtrl::class);
42  $ctrl_mock->expects($this->any())
43  ->method("getFormAction")
44  ->willReturnCallback(function () {
45  return "testFormAction";
46  });
47  $this->setGlobalVariable("ilCtrl", $ctrl_mock);
48 
49  $component_factory = $this->createMock(ilComponentFactory::class);
50  $component_factory->method("getActivePluginsInSlot")->willReturn(new ArrayIterator());
51  $this->setGlobalVariable("component.factory", $component_factory);
52 
53  $this->parentObj_mock = $this->createMock(ilTestParticipantsGUI::class);
54  $objTest_mock = $this->createMock(ilObjTest::class);
55 
56  $this->parentObj_mock
57  ->expects($this->any())
58  ->method("getTestObj")
59  ->willReturn($objTest_mock);
60 
61  //$this->parentObj_mock->setTestObj($objTest_mock);
62  $this->tableGui = new ilTestParticipantsTableGUI($this->parentObj_mock, "", $DIC['ui.factory'], $DIC['ui.renderer']);
63  }
64 
66  {
67  $this->assertInstanceOf(ilTestParticipantsTableGUI::class, $this->tableGui);
68  }
69 
70  public function testManageResultsCommandsEnabled(): void
71  {
72  $this->assertIsBool($this->tableGui->isManageResultsCommandsEnabled());
73  $this->tableGui->setManageResultsCommandsEnabled(false);
74  $this->assertFalse($this->tableGui->isManageResultsCommandsEnabled());
75  $this->tableGui->setManageResultsCommandsEnabled(true);
76  $this->assertTrue($this->tableGui->isManageResultsCommandsEnabled());
77  }
78 
79  public function testManageInviteesCommandsEnabled(): void
80  {
81  $this->assertIsBool($this->tableGui->isManageInviteesCommandsEnabled());
82  $this->tableGui->setManageInviteesCommandsEnabled(false);
83  $this->assertFalse($this->tableGui->isManageInviteesCommandsEnabled());
84  $this->tableGui->setManageInviteesCommandsEnabled(true);
85  $this->assertTrue($this->tableGui->isManageInviteesCommandsEnabled());
86  }
87 
88  public function testRowKeyDataField(): void
89  {
90  $this->tableGui->setRowKeyDataField("test");
91  $this->assertEquals("test", $this->tableGui->getRowKeyDataField());
92  }
93 
95  {
96  $this->assertIsBool($this->tableGui->isParticipantHasSolutionsFilterEnabled());
97  $this->tableGui->setParticipantHasSolutionsFilterEnabled(false);
98  $this->assertFalse($this->tableGui->isParticipantHasSolutionsFilterEnabled());
99  $this->tableGui->setParticipantHasSolutionsFilterEnabled(true);
100  $this->assertTrue($this->tableGui->isParticipantHasSolutionsFilterEnabled());
101  }
102 
103  public function testNumericOrdering(): void
104  {
105  $this->assertTrue($this->tableGui->numericOrdering("access"));
106  $this->assertTrue($this->tableGui->numericOrdering("tries"));
107  $this->assertFalse($this->tableGui->numericOrdering("randomString"));
108  }
109 }
global $DIC
Definition: feed.php:28
Class ilTestParticipantsTableGUITest.
setGlobalVariable(string $name, $value)
Class ilTestBaseClass.