ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilParticipantsTestResultsTableGUITest.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_tpl();
38  $this->addGlobal_uiFactory();
39  $this->addGlobal_uiRenderer();
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 
48  $this->setGlobalVariable("ilCtrl", $ctrl_mock);
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(ilParticipantsTestResultsGUI::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->tableGui = new ilParticipantsTestResultsTableGUI($this->parentObj_mock, "", $DIC['ui.factory'], $DIC['ui.renderer']);
62  }
63 
65  {
66  $this->assertInstanceOf(ilParticipantsTestResultsTableGUI::class, $this->tableGui);
67  }
68 
69  public function testAccessResultsCommandsEnabled(): void
70  {
71  $this->assertIsBool($this->tableGui->isAccessResultsCommandsEnabled());
72  $this->tableGui->setAccessResultsCommandsEnabled(true);
73  $this->assertTrue($this->tableGui->isAccessResultsCommandsEnabled());
74 
75  $this->tableGui->setAccessResultsCommandsEnabled(false);
76  $this->assertFalse($this->tableGui->isAccessResultsCommandsEnabled());
77  }
78 
79  public function testManageResultsCommandsEnabled(): void
80  {
81  $this->assertIsBool($this->tableGui->isManageResultsCommandsEnabled());
82  $this->tableGui->setManageResultsCommandsEnabled(true);
83  $this->assertTrue($this->tableGui->isManageResultsCommandsEnabled());
84 
85  $this->tableGui->setManageResultsCommandsEnabled(false);
86  $this->assertFalse($this->tableGui->isManageResultsCommandsEnabled());
87  }
88 
89  public function testNumericOrdering(): void
90  {
91  $this->assertTrue($this->tableGui->numericOrdering("scored_pass"));
92  $this->assertTrue($this->tableGui->numericOrdering("answered_questions"));
93  $this->assertTrue($this->tableGui->numericOrdering("reached_points"));
94  $this->assertTrue($this->tableGui->numericOrdering("percent_result"));
95  $this->assertFalse($this->tableGui->numericOrdering("randomText"));
96  }
97 }
ilParticipantsTestResultsGUI: ilTestEvaluationGUI ilParticipantsTestResultsGUI: ilAssQuestionPageGUI...
global $DIC
Definition: feed.php:28
setGlobalVariable(string $name, $value)
Class ilTestBaseClass.
Class ilParticipantsTestResultsTableGUITest.