ILIAS  release_8 Revision v8.24
ilTestQuestionsTableGUITest.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 $this->addGlobal_ilAccess();
35
36 $lng_mock = $this->createMock(ilLanguage::class);
37 $ctrl_mock = $this->createMock(ilCtrl::class);
38 $ctrl_mock->expects($this->any())
39 ->method("getFormAction")
40 ->willReturnCallback(function () {
41 return "testFormAction";
42 });
43
44 $this->setGlobalVariable("lng", $lng_mock);
45 $this->setGlobalVariable("ilCtrl", $ctrl_mock);
46 $this->setGlobalVariable("tpl", $this->createMock(ilGlobalPageTemplate::class));
47 $this->setGlobalVariable("component.repository", $this->createMock(ilComponentRepository::class));
48 $component_factory = $this->createMock(ilComponentFactory::class);
49 $component_factory->method("getActivePluginsInSlot")->willReturn(new ArrayIterator());
50 $this->setGlobalVariable("component.factory", $component_factory);
51 $this->setGlobalVariable("ilDB", $this->createMock(ilDBInterface::class));
52 $this->setGlobalVariable("ui.renderer", $this->createMock(\ILIAS\UI\Renderer::class));
53 $this->setGlobalVariable("ui.factory", $this->createMock(\ILIAS\UI\Factory::class));
54
55 $this->parentObj_mock = $this->getMockBuilder(ilObjTestGUI::class)->disableOriginalConstructor()->onlyMethods(array('getObject'))->getMock();
56 $this->parentObj_mock->expects($this->any())->method('getObject')->willReturn($this->createMock(ilObjTest::class));
57 $this->tableGui = new ilTestQuestionsTableGUI($this->parentObj_mock, "", 0);
58 }
59
61 {
62 $this->assertInstanceOf(ilTestQuestionsTableGUI::class, $this->tableGui);
63 }
64
65 public function testQuestionManagingEnabled(): void
66 {
67 $this->assertIsBool($this->tableGui->isQuestionManagingEnabled());
68 $this->tableGui->setQuestionManagingEnabled(false);
69 $this->assertFalse($this->tableGui->isQuestionManagingEnabled());
70 $this->tableGui->setQuestionManagingEnabled(true);
71 $this->assertTrue($this->tableGui->isQuestionManagingEnabled());
72 }
73
74 public function testPositionInsertCommandsEnabled(): void
75 {
76 $this->assertIsBool($this->tableGui->isPositionInsertCommandsEnabled());
77 $this->tableGui->setPositionInsertCommandsEnabled(false);
78 $this->assertFalse($this->tableGui->isPositionInsertCommandsEnabled());
79 $this->tableGui->setPositionInsertCommandsEnabled(true);
80 $this->assertTrue($this->tableGui->isPositionInsertCommandsEnabled());
81 }
82
83 public function testQuestionPositioningEnabled(): void
84 {
85 $this->assertIsBool($this->tableGui->isQuestionPositioningEnabled());
86 $this->tableGui->setQuestionPositioningEnabled(false);
87 $this->assertFalse($this->tableGui->isQuestionPositioningEnabled());
88 $this->tableGui->setQuestionPositioningEnabled(true);
89 $this->assertTrue($this->tableGui->isQuestionPositioningEnabled());
90 }
91
93 {
94 $this->assertIsBool($this->tableGui->isObligatoryQuestionsHandlingEnabled());
95 $this->tableGui->setObligatoryQuestionsHandlingEnabled(false);
96 $this->assertFalse($this->tableGui->isObligatoryQuestionsHandlingEnabled());
97 $this->tableGui->setObligatoryQuestionsHandlingEnabled(true);
98 $this->assertTrue($this->tableGui->isObligatoryQuestionsHandlingEnabled());
99 }
100
101 public function testTotalPoints(): void
102 {
103 $this->assertIsFloat($this->tableGui->getTotalPoints());
104 $this->tableGui->setTotalPoints(125.251);
105 $this->assertEquals(125.251, $this->tableGui->getTotalPoints());
106 }
107
109 {
110 $this->assertIsBool($this->tableGui->isQuestionRemoveRowButtonEnabled());
111 $this->tableGui->setQuestionRemoveRowButtonEnabled(false);
112 $this->assertFalse($this->tableGui->isQuestionRemoveRowButtonEnabled());
113 $this->tableGui->setQuestionRemoveRowButtonEnabled(true);
114 $this->assertTrue($this->tableGui->isQuestionRemoveRowButtonEnabled());
115 }
116}
Class ilObjTestGUI.
Class ilTestBaseClass.
setGlobalVariable(string $name, $value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.