ILIAS  release_8 Revision v8.24
ilTestParticipantsTableGUITest.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
26{
29
30 protected function setUp(): void
31 {
32 parent::setUp();
33
34 $lng_mock = $this->createMock(ilLanguage::class);
35 $ctrl_mock = $this->createMock(ilCtrl::class);
36 $ctrl_mock->expects($this->any())
37 ->method("getFormAction")
38 ->willReturnCallback(function () {
39 return "testFormAction";
40 });
41
42 $renderer_mock = $this->createMock(\ILIAS\UI\Renderer::class);
43 $ui_factory_mock = $this->createMock(\ILIAS\UI\Factory::class);
44 $this->setGlobalVariable("lng", $lng_mock);
45 $this->setGlobalVariable("ilCtrl", $ctrl_mock);
46 $this->setGlobalVariable("tpl", $this->createMock(ilGlobalPageTemplate::class));
47 $this->setGlobalVariable("ui.renderer", $renderer_mock);
48 $this->setGlobalVariable("ui.factory", $ui_factory_mock);
49
50 $this->setGlobalVariable("component.repository", $this->createMock(ilComponentRepository::class));
51 $component_factory = $this->createMock(ilComponentFactory::class);
52 $component_factory->method("getActivePluginsInSlot")->willReturn(new ArrayIterator());
53 $this->setGlobalVariable("component.factory", $component_factory);
54 $this->setGlobalVariable("ilDB", $this->createMock(ilDBInterface::class));
55
56 $this->parentObj_mock = $this->createMock(ilTestParticipantsGUI::class);
57 $objTest_mock = $this->createMock(ilObjTest::class);
58
59 $this->parentObj_mock
60 ->expects($this->any())
61 ->method("getTestObj")
62 ->willReturn($objTest_mock);
63
64 $this->parentObj_mock->object = $objTest_mock;
65 $this->tableGui = new ilTestParticipantsTableGUI($this->parentObj_mock, "");
66 }
67
69 {
70 $this->assertInstanceOf(ilTestParticipantsTableGUI::class, $this->tableGui);
71 }
72
73 public function testManageResultsCommandsEnabled(): void
74 {
75 $this->assertIsBool($this->tableGui->isManageResultsCommandsEnabled());
76 $this->tableGui->setManageResultsCommandsEnabled(false);
77 $this->assertFalse($this->tableGui->isManageResultsCommandsEnabled());
78 $this->tableGui->setManageResultsCommandsEnabled(true);
79 $this->assertTrue($this->tableGui->isManageResultsCommandsEnabled());
80 }
81
82 public function testManageInviteesCommandsEnabled(): void
83 {
84 $this->assertIsBool($this->tableGui->isManageInviteesCommandsEnabled());
85 $this->tableGui->setManageInviteesCommandsEnabled(false);
86 $this->assertFalse($this->tableGui->isManageInviteesCommandsEnabled());
87 $this->tableGui->setManageInviteesCommandsEnabled(true);
88 $this->assertTrue($this->tableGui->isManageInviteesCommandsEnabled());
89 }
90
91 public function testRowKeyDataField(): void
92 {
93 $this->tableGui->setRowKeyDataField("test");
94 $this->assertEquals("test", $this->tableGui->getRowKeyDataField());
95 }
96
97 public function testAnonymity(): void
98 {
99 $this->tableGui->setAnonymity("test");
100 $this->assertEquals("test", $this->tableGui->getAnonymity());
101 }
102
104 {
105 $this->assertIsBool($this->tableGui->isParticipantHasSolutionsFilterEnabled());
106 $this->tableGui->setParticipantHasSolutionsFilterEnabled(false);
107 $this->assertFalse($this->tableGui->isParticipantHasSolutionsFilterEnabled());
108 $this->tableGui->setParticipantHasSolutionsFilterEnabled(true);
109 $this->assertTrue($this->tableGui->isParticipantHasSolutionsFilterEnabled());
110 }
111
112 public function testNumericOrdering(): void
113 {
114 $this->assertTrue($this->tableGui->numericOrdering("access"));
115 $this->assertTrue($this->tableGui->numericOrdering("tries"));
116 $this->assertFalse($this->tableGui->numericOrdering("randomString"));
117 }
118}
Class ilTestBaseClass.
setGlobalVariable(string $name, $value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.