ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilObjTestGUITest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
28 {
30 
31  protected function setUp(): void
32  {
33  if (!defined('ANONYMOUS_USER_ID')) {
34  define('ANONYMOUS_USER_ID', 13);
35  }
36 
37  global $DIC;
38 
39  $this->dic = is_object($DIC) ? clone $DIC : $DIC;
40 
41  $DIC = new Container();
42 
43  parent::setUp();
44 
45 
46  $this->addGlobal_lng();
47  $this->addGlobal_ilCtrl();
48  $this->addGlobal_ilDB();
50  $this->addGlobal_tree();
51  $this->addGlobal_http();
52  $this->addGlobal_ilLocator();
53  $this->addGlobal_ilUser();
54  $this->addGlobal_ilAccess();
55  $this->addGlobal_ilSetting();
56  $this->addGlobal_rbacreview();
57  $this->addGlobal_ilToolbar();
58  $this->addGlobal_rbacsystem();
59  $this->addGlobal_filesystem();
60  $this->addGlobal_upload();
61  $this->addGlobal_objDefinition();
62  $this->addGlobal_tpl();
63  $this->addGlobal_ilErr();
64  $this->addGlobal_ilTabs();
65  $this->addGlobal_ilias();
68  $this->addGlobal_uiFactory();
69  $this->addGlobal_uiRenderer();
70  $this->addGlobal_skillService();
71  $this->addGlobal_ilHelp();
72  $this->addGlobal_ilObjDataCache();
73  $this->addGlobal_http();
74  $this->addGlobal_ilRbacAdmin();
75  $this->addGlobal_objectService();
77 
78  $this->testObj = new ilObjTestGUI();
79  }
80 
81  protected function tearDown(): void
82  {
83  global $DIC;
84 
85  $DIC = $this->dic;
86 
87  parent::tearDown();
88  }
89 
91  {
92  $this->assertInstanceOf(ilObjTestGUI::class, $this->testObj);
93  }
94 
95  public function testTestAccess(): void
96  {
97  $testAccess_mock = $this->createMock(ilTestAccess::class);
98 
99  $this->testObj->setTestAccess($testAccess_mock);
100  $this->assertEquals($testAccess_mock, $this->testObj->getTestAccess());
101  }
102 
103  public function testGetTabsManager(): void
104  {
105  $testTabsManager_mock = $this->createMock(ilTestTabsManager::class);
106 
107  $this->testObj->setTabsManager($testTabsManager_mock);
108  $this->assertEquals($testTabsManager_mock, $this->testObj->getTabsManager());
109  }
110 
111  public function testRunObject(): void
112  {
113  $ctrl_mock = $this->createMock(ilCtrl::class);
114  $ctrl_mock
115  ->expects($this->once())
116  ->method("redirect")
117  ->with($this->testObj, "infoScreen");
118  $this->setGlobalVariable("ilCtrl", $ctrl_mock);
119 
120  $testObj = new ilObjTestGUI();
121 
122  $testObj->runObject();
123  }
124 
125  public function testOutEvaluationObject(): void
126  {
127  $ctrl_mock = $this->createMock(ilCtrl::class);
128  $ctrl_mock
129  ->expects($this->once())
130  ->method("redirectByClass")
131  ->with("iltestevaluationgui", "outEvaluation");
132  $this->setGlobalVariable("ilCtrl", $ctrl_mock);
133 
134  $testObj = new ilObjTestGUI();
135 
136  $testObj->outEvaluationObject();
137  }
138 
139  public function testBackObject(): void
140  {
141  $ctrl_mock = $this->createMock(ilCtrl::class);
142  $ctrl_mock
143  ->expects($this->once())
144  ->method("redirect")
145  ->with($this->testObj, "questions");
146  $this->setGlobalVariable("ilCtrl", $ctrl_mock);
147 
148  $testObj = new ilObjTestGUI();
149 
150  $testObj->backObject();
151  }
152 
153  public function testCancelCreateQuestionObject(): void
154  {
155  $ctrl_mock = $this->createMock(ilCtrl::class);
156  $ctrl_mock
157  ->expects($this->once())
158  ->method("redirect")
159  ->with($this->testObj, "questions");
160  $this->setGlobalVariable("ilCtrl", $ctrl_mock);
161 
162  $testObj = new ilObjTestGUI();
163 
164  $testObj->cancelCreateQuestionObject();
165  }
166 
167  public function testCancelRemoveQuestionsObject(): void
168  {
169  $ctrl_mock = $this->createMock(ilCtrl::class);
170  $ctrl_mock
171  ->expects($this->once())
172  ->method("redirect")
173  ->with($this->testObj, "questions");
174  $this->setGlobalVariable("ilCtrl", $ctrl_mock);
175 
176  $testObj = new ilObjTestGUI();
177 
178  $testObj->cancelRemoveQuestionsObject();
179  }
180 }
Class ilObjTestGUI.
cancelCreateQuestionObject()
Called when the creation of a new question is cancelled.
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
test_instantiateObject_shouldReturnInstance()
Class ilObjTestGUITest.
cancelRemoveQuestionsObject()
Cancels the removal of questions from the test.
global $DIC
Definition: feed.php:28
setGlobalVariable(string $name, $value)
Class ilTestBaseClass.
backObject()
Called when the back button in the question browser was pressed.
ilObjTestGUI $testObj