ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilParticipantsTestResultsTableGUITest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(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  $this->setGlobalVariable("lng", $lng_mock);
43  $this->setGlobalVariable("ilCtrl", $ctrl_mock);
44  $this->setGlobalVariable("tpl", $this->createMock(ilGlobalPageTemplate::class));
45  $this->setGlobalVariable("component.repository", $this->createMock(ilComponentRepository::class));
46  $component_factory = $this->createMock(ilComponentFactory::class);
47  $component_factory->method("getActivePluginsInSlot")->willReturn(new ArrayIterator());
48  $this->setGlobalVariable("component.factory", $component_factory);
49  $this->setGlobalVariable("ilDB", $this->createMock(ilDBInterface::class));
50 
51  $this->parentObj_mock = $this->createMock(ilParticipantsTestResultsGUI::class);
52  $objTest_mock = $this->createMock(ilObjTest::class);
53 
54  $this->parentObj_mock
55  ->expects($this->any())
56  ->method("getTestObj")
57  ->willReturn($objTest_mock);
58 
59  $this->parentObj_mock->object = $objTest_mock;
60  $this->tableGui = new ilParticipantsTestResultsTableGUI($this->parentObj_mock, "");
61  }
62 
64  {
65  $this->assertInstanceOf(ilParticipantsTestResultsTableGUI::class, $this->tableGui);
66  }
67 
68  public function testAccessResultsCommandsEnabled(): void
69  {
70  $this->assertIsBool($this->tableGui->isAccessResultsCommandsEnabled());
71  $this->tableGui->setAccessResultsCommandsEnabled(true);
72  $this->assertTrue($this->tableGui->isAccessResultsCommandsEnabled());
73 
74  $this->tableGui->setAccessResultsCommandsEnabled(false);
75  $this->assertFalse($this->tableGui->isAccessResultsCommandsEnabled());
76  }
77 
78  public function testManageResultsCommandsEnabled(): void
79  {
80  $this->assertIsBool($this->tableGui->isManageResultsCommandsEnabled());
81  $this->tableGui->setManageResultsCommandsEnabled(true);
82  $this->assertTrue($this->tableGui->isManageResultsCommandsEnabled());
83 
84  $this->tableGui->setManageResultsCommandsEnabled(false);
85  $this->assertFalse($this->tableGui->isManageResultsCommandsEnabled());
86  }
87 
88  public function testAnonymity(): void
89  {
90  $this->tableGui->setAnonymity(true);
91  $this->assertTrue($this->tableGui->getAnonymity());
92 
93  $this->tableGui->setAnonymity(false);
94  $this->assertFalse($this->tableGui->getAnonymity());
95  }
96 
97  public function testNumericOrdering(): void
98  {
99  $this->assertTrue($this->tableGui->numericOrdering("scored_pass"));
100  $this->assertTrue($this->tableGui->numericOrdering("answered_questions"));
101  $this->assertTrue($this->tableGui->numericOrdering("points"));
102  $this->assertTrue($this->tableGui->numericOrdering("percent_result"));
103  $this->assertFalse($this->tableGui->numericOrdering("randomText"));
104  }
105 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setGlobalVariable(string $name, $value)
Class ilTestBaseClass.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...