19 declare(strict_types=1);
33 protected function defineGlobalConstants(): void
35 if (!defined(
'ILIAS_HTTP_PATH')) {
36 define(
'ILIAS_HTTP_PATH',
'http://localhost');
38 if (!defined(
'CLIENT_DATA_DIR')) {
39 define(
'CLIENT_DATA_DIR',
'/var/iliasdata');
41 if (!defined(
'IL_INST_ID')) {
42 define(
'IL_INST_ID',
'0');
44 if (!defined(
"ANONYMOUS_USER_ID")) {
45 define(
"ANONYMOUS_USER_ID", 13);
47 if (!defined(
'ANONYMOUS_USER_ID')) {
48 define(
'ANONYMOUS_USER_ID', 13);
50 if (!defined(
'ROOT_FOLDER_ID')) {
51 define(
'ROOT_FOLDER_ID', 8);
53 if (!defined(
'ILIAS_LOG_ENABLED')) {
54 define(
'ILIAS_LOG_ENABLED',
true);
56 if (!defined(
'ILIAS_LOG_DIR')) {
57 define(
'ILIAS_LOG_DIR',
'/var/log');
59 if (!defined(
'ILIAS_LOG_FILE')) {
60 define(
'ILIAS_LOG_FILE',
'/var/log/ilias.log');
68 protected function setGlobalVariable(
string $name, $value): void
75 $DIC[$name] =
static function (
Container $c) use ($value) {
83 protected function getGlobalTemplateMock()
85 return $this->getMockBuilder(ilTemplate::class)->disableOriginalConstructor()->getMock();
91 protected function getDatabaseMock()
93 return $this->getMockBuilder(ilDBInterface::class)->disableOriginalConstructor()->getMock();
99 protected function getIliasMock()
101 $mock = $this->getMockBuilder(ILIAS::class)->disableOriginalConstructor()->getMock();
105 $account->fullname =
'Esther Tester';
107 $mock->account = $account;
112 protected function addGlobal_ilAccess(): void
114 $this->setGlobalVariable(
'ilAccess', $this->createMock(ilAccess::class));
117 protected function addGlobal_ilUser(): void
119 $this->setGlobalVariable(
'ilUser', $this->createMock(ilObjUser::class));
122 protected function addGlobal_objDefinition(): void
124 $this->setGlobalVariable(
'objDefinition', $this->createMock(ilObjectDefinition::class));
127 protected function addGlobal_tree(): void
129 $this->setGlobalVariable(
'tree', $this->createMock(ilTree::class));
132 protected function addGlobal_ilSetting(): void
134 $this->setGlobalVariable(
'ilSetting', $this->createMock(ilSetting::class));
137 protected function addGlobal_rbacsystem(): void
139 $this->setGlobalVariable(
'rbacsystem', $this->createMock(ilRbacSystem::class));
142 protected function addGlobal_ilRbacAdmin(): void
144 $this->setGlobalVariable(
'rbacadmin', $this->createMock(ilRbacAdmin::class));
147 protected function addGlobal_ilCtrl(): void
149 $this->setGlobalVariable(
'ilCtrl', $this->createMock(ilCtrl::class));
152 protected function addGlobal_lng(): void
154 $this->setGlobalVariable(
'lng', $this->createMock(ilLanguage::class));
157 protected function addGlobal_filesystem(): void
159 $this->setGlobalVariable(
'filesystem', $this->createMock(Filesystems::class));
162 protected function addGlobal_static_url(): void
164 $this->setGlobalVariable(
'static_url', $this->createMock(
ILIAS\
StaticURL\Services::class));
167 protected function addGlobal_upload(): void
169 $this->setGlobalVariable(
'upload', $this->createMock(FileUpload::class));
172 protected function addGlobal_ilDB(): void
174 $this->setGlobalVariable(
'ilDB', $this->createMock(ilDBInterface::class));
177 protected function addGlobal_ilBench(): void
179 $this->setGlobalVariable(
'ilBench', $this->createMock(ilBenchmark::class));
182 protected function addGlobal_ilLog(): void
184 $this->setGlobalVariable(
'ilLog', $this->createMock(ilLogger::class));
187 protected function addGlobal_ilias(): void
189 $this->setGlobalVariable(
'ilias', $this->getIliasMock());
192 protected function addGlobal_ilErr(): void
194 $this->setGlobalVariable(
'ilErr', $this->createMock(ilErrorHandling::class));
197 protected function addGlobal_GlobalScreenService(): void
199 $this->setGlobalVariable(
'global_screen', $this->createMock(
ILIAS\
GlobalScreen\Services::class));
202 protected function addGlobal_ilNavigationHistory(): void
204 $this->setGlobalVariable(
'ilNavigationHistory', $this->createMock(ilNavigationHistory::class));
207 protected function addGlobal_ilAppEventHandler(): void
209 $this->setGlobalVariable(
'ilAppEventHandler', $this->createMock(ilAppEventHandler::class));
212 protected function addGlobal_tpl(): void
214 $this->setGlobalVariable(
'tpl', $this->createMock(ilGlobalPageTemplate::class));
217 protected function addGlobal_ilComponentRepository(): void
219 $this->setGlobalVariable(
'component.repository', $this->createMock(ilComponentRepository::class));
222 protected function addGlobal_ilComponentFactory(): void
224 $this->setGlobalVariable(
'component.factory', $this->createMock(ilComponentFactory::class));
227 protected function addGlobal_ilTabs(): void
229 $this->setGlobalVariable(
'ilTabs', $this->createMock(ilTabsGUI::class));
232 protected function addGlobal_ilObjDataCache(): void
234 $this->setGlobalVariable(
'ilObjDataCache', $this->createMock(ilObjectDataCache::class));
237 protected function addGlobal_ilLocator(): void
239 $this->setGlobalVariable(
'ilLocator', $this->createMock(ilLocatorGUI::class));
242 protected function addGlobal_rbacreview(): void
244 $this->setGlobalVariable(
'rbacreview', $this->createMock(ilRbacReview::class));
247 protected function addGlobal_ilToolbar(): void
249 $this->setGlobalVariable(
'ilToolbar', $this->createMock(ilToolbarGUI::class));
252 protected function addGlobal_http(): void
254 $request_mock = $this->getMockBuilder(\Psr\Http\Message\ServerRequestInterface::class)
255 ->disableOriginalConstructor()
257 $request_mock->method(
'getUri')
258 ->willReturn(
new GuzzleURI(
'http://wwww.ilias.de'));
259 $http_mock = $this->getMockBuilder(HTTPServices::class)->disableOriginalConstructor()
261 $http_mock->method(
'request')
262 ->willReturn($request_mock);
263 $this->setGlobalVariable(
'http', $http_mock);
266 protected function addGlobal_ilIliasIniFile(): void
268 $this->setGlobalVariable(
'ilIliasIniFile', $this->createMock(ilIniFile::class));
271 protected function addGlobal_ilLoggerFactory(): void
273 $this->setGlobalVariable(
'ilLoggerFactory', $this->createMock(ilLoggerFactory::class));
276 protected function addGlobal_ilHelp(): void
278 $this->setGlobalVariable(
'ilHelp', $this->createMock(ilHelpGUI::class));
281 protected function addGlobal_uiService(): void
283 $this->setGlobalVariable(
'uiService', $this->createMock(\ilUIService::class));
286 protected function addGlobal_uiFactory(): void
288 $this->setGlobalVariable(
'ui.factory', $this->createMock(FactoryInternal::class));
291 protected function addGlobal_uiRenderer(): void
293 $this->setGlobalVariable(
'ui.renderer', $this->createMock(
ILIAS\
UI\
Implementation\DefaultRenderer::class));
296 protected function addGlobal_refinery(): void
298 $refineryMock = $this->getMockBuilder(RefineryFactory::class)->disableOriginalConstructor()->getMock();
299 $refineryMock->expects(self::any())->method(
'random')->willReturn($this->getMockBuilder(RandomGroup::class)->getMock());
300 $this->setGlobalVariable(
'refinery', $refineryMock);
303 protected function addGlobal_skillService(): void
305 $this->setGlobalVariable(
'skill', $this->createMock(
ILIAS\Skill\Service\SkillService::class));
308 protected function addGlobal_objectService(): void
311 $DIC[
'object.customicons.factory'] = $this->getMockBuilder(ilObjectCustomIconFactory::class)->disableOriginalConstructor()->getMock();
312 $object_mock = $this->getMockBuilder(\ilObjectService::class)->disableOriginalConstructor()->getMock();
314 $this->setGlobalVariable(
'object', $object_mock);
317 protected function addGlobal_resourceStorage(): void
319 $this->setGlobalVariable(
'resource_storage', $this->createMock(\
ILIAS\
ResourceStorage\Services::class));
322 protected function addGlobal_fileDelivery(): void
324 $this->setGlobalVariable(
326 $this->getFileDelivery()
330 protected function addGlobal_uiUploadLimitResolver(): void
335 protected function getFileDelivery(): \
ILIAS\FileDelivery\
Services 338 new ILIAS\FileDelivery\
Token\Signer\Key\Secret\SecretKeyRotation(
339 new ILIAS\FileDelivery\
Token\Signer\Key\Secret\SecretKey(
'blup')
342 $http_mock = $this->getMockBuilder(HTTPServices::class)->disableOriginalConstructor()->getMock();
343 $response_builder_mock = $this->createMock(\
ILIAS\FileDelivery\Delivery\ResponseBuilder\ResponseBuilder::class);
344 return new \ILIAS\FileDelivery\Services(
345 new ILIAS\FileDelivery\Delivery\StreamDelivery(
348 $response_builder_mock,
349 $response_builder_mock
351 new \
ILIAS\FileDelivery\Delivery\LegacyDelivery(
353 $response_builder_mock,
354 $response_builder_mock
361 protected function getTestObjMock():
ilObjTest 363 $test_mock = $this->getMockBuilder(ilObjTest::class)->disableOriginalConstructor()->getMock();
364 $test_mock->method(
'getLocalDIC')->willReturn(
365 $this->buildLocalDICMock()
370 protected function buildLocalDICMock():
ILIAS\
Test\TestDIC
372 $local_dic_mock = $this->getMockBuilder(
ILIAS\
Test\TestDIC::class)
373 ->onlyMethods([])->getMock();
374 $local_dic_mock[
'question.general_properties.repository'] = fn(Pimple\
Container $c)
375 => $this->createMock(
376 ILIAS\TestQuestionPool\Questions\GeneralQuestionPropertiesRepository::class
378 $local_dic_mock[
'request_data_collector'] = fn(Pimple\
Container $c)
379 => $this->createMock(
382 $local_dic_mock[
'participant.access_filter.factory'] = fn(Pimple\
Container $c)
383 => $this->createMock(
384 \ilTestParticipantAccessFilterFactory::class
386 $local_dic_mock[
'logging.logger'] = fn(Pimple\
Container $c)
387 => $this->createMock(
390 $local_dic_mock[
'logging.viewer'] = fn(Pimple\
Container $c)
391 => $this->createMock(
394 $local_dic_mock[
'shuffler'] = fn(Pimple\
Container $c)
395 => $this->createMock(
396 \ilTestShuffler::class
398 $local_dic_mock[
'results.presentation.factory'] = fn(Pimple\
Container $c)
399 => $this->createMock(
402 $local_dic_mock[
'results.data.factory'] = fn(Pimple\
Container $c)
403 => $this->createMock(
406 $local_dic_mock[
'results.toplist.repository'] = fn(Pimple\
Container $c)
407 => $this->createMock(
410 $local_dic_mock[
'results.data.test_result_repository'] = fn(Pimple\
Container $c)
411 => $this->createMock(
414 $local_dic_mock[
'questions.properties.repository'] = fn(Pimple\
Container $c)
415 => $this->createMock(
416 ILIAS\
Test\Questions\Properties\Repository::class
418 return $local_dic_mock;
Interface Observer Contains several chained tasks and infos about them.
Customizing of pimple-DIC for ILIAS.
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...