ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilTestBaseTestCaseTrait.php File Reference

Go to the source code of this file.

Functions

 defineGlobalConstants ()
 
 setGlobalVariable (string $name, mixed $value)
 
 getGlobalTemplateMock ()
 
 getDatabaseMock ()
 
 getIliasMock ()
 
 addGlobal_ilAccess ()
 
 addGlobal_dataFactory ()
 
 addGlobal_ilUser ()
 
 addGlobal_objDefinition ()
 
 addGlobal_tree ()
 
 addGlobal_ilSetting ()
 
 addGlobal_rbacsystem ()
 
 addGlobal_ilRbacAdmin ()
 
 addGlobal_ilCtrl ()
 
 addGlobal_lng ()
 
 addGlobal_filesystem ()
 
 addGlobal_static_url ()
 
 addGlobal_upload ()
 
 addGlobal_ilDB ()
 
 addGlobal_ilBench ()
 
 addGlobal_ilLog ()
 
 addGlobal_ilias ()
 
 addGlobal_ilErr ()
 
 addGlobal_GlobalScreenService ()
 
 addGlobal_ilNavigationHistory ()
 
 addGlobal_ilAppEventHandler ()
 
 addGlobal_tpl ()
 
 addGlobal_ilComponentRepository ()
 
 addGlobal_ilComponentFactory ()
 
 addGlobal_ilTabs ()
 
 addGlobal_ilObjDataCache ()
 
 addGlobal_ilLocator ()
 
 addGlobal_rbacreview ()
 
 addGlobal_ilToolbar ()
 
 addGlobal_http ()
 
 addGlobal_ilIliasIniFile ()
 
 addGlobal_ilLoggerFactory ()
 
 addGlobal_ilHelp ()
 
 addGlobal_uiService ()
 
 addGlobal_uiFactory ()
 
 addGlobal_uiRenderer ()
 
 addGlobal_refinery ()
 
 addGlobal_skillService ()
 
 addGlobal_objectMetadata ()
 
 addGlobal_objectService ()
 
 addGlobal_resourceStorage ()
 
 addGlobal_fileDelivery ()
 
 addGlobal_user ()
 
 addGlobal_uiUploadLimitResolver ()
 
 getFileDelivery ()
 
 getTestObjMock ()
 
 buildLocalDICMock ()
 
 adaptDICServiceMock (string $service_name, callable $adapt)
 
 expectTplContent (mixed $expected_content)
 Expect that the template content will be set to the specified expected content. More...
 
 mockCommand (string $command)
 
 expectRedirect (InvocationOrder $expects, string $method)
 
 mockPostRequest (array $properties, array $query_parameters=[])
 
 mockGetRequest (array $query_parameters=[])
 
 mockRequest (string $request_method, array $properties, array $query_parameters)
 

Variables

trait ilTestBaseTestCaseTrait
 

Function Documentation

◆ adaptDICServiceMock()

adaptDICServiceMock ( string  $service_name,
callable  $adapt 
)
protected

Definition at line 511 of file ilTestBaseTestCaseTrait.php.

511 : void
512 {
513 $reflection_function = new ReflectionFunction($adapt);
514 if ($reflection_function->getNumberOfParameters() !== 1) {
515 throw new \Exception('Callable must have exactly one parameter of type MockObject.');
516 }
517
518 if (isset($this->services[$service_name])) {
519 global $DIC;
520 if (!isset($DIC[$this->services[$service_name]])) {
521 $DIC[$this->services[$service_name]] = $this->createMock($service_name);
522 }
523
524 $adapt($DIC[$this->services[$service_name]]);
525 }
526 }
global $DIC
Definition: shib_login.php:26

References $DIC.

Referenced by ILIAS\Test\Tests\Results\Data\TestResultRepositoryTest\mockGetPassedParticipants(), ILIAS\Test\Tests\Results\Data\TestResultRepositoryTest\mockGetResultQuery(), ILIAS\Test\Tests\Results\Data\TestResultRepositoryTest\mockGetUserIds(), ILIAS\Test\Tests\Results\Data\TestResultRepositoryTest\mockReadResultStatusQuery(), ILIAS\Test\Tests\Results\Data\TestResultRepositoryTest\mockUpdateTestAttemptResult(), ILIAS\Test\Tests\Results\Data\TestResultRepositoryTest\mockUpdateTestResultCache(), and ILIAS\Test\Tests\Results\Data\TestResultRepositoryTest\testReadFromCache().

+ Here is the caller graph for this function:

◆ addGlobal_dataFactory()

addGlobal_dataFactory ( )
protected

Definition at line 180 of file ilTestBaseTestCaseTrait.php.

180 : void
181 {
182 $this->setGlobalVariable('DataFactory', $this->createMock(DataFactory::class));
183 }
setGlobalVariable(string $name, mixed $value)

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_fileDelivery()

addGlobal_fileDelivery ( )
protected

Definition at line 406 of file ilTestBaseTestCaseTrait.php.

406 : void
407 {
408 $this->setGlobalVariable(
409 'file_delivery',
410 $this->getFileDelivery()
411 );
412 }

References getFileDelivery(), and setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), and ilAssFileUploadUploadsExporterTest\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_filesystem()

addGlobal_filesystem ( )
protected

Definition at line 225 of file ilTestBaseTestCaseTrait.php.

225 : void
226 {
227 $this->setGlobalVariable('filesystem', $this->createMock(Filesystems::class));
228 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), ilObjTestListGUITest\setUp(), ilObjTestTest\setUp(), ilObjTestVerificationGUITest\setUp(), ilObjTestVerificationListGUITest\setUp(), ilTestProcessLockFileStorageTest\setUp(), assBaseTestCase\setUp(), and ilAssQuestionProcessLockFileStorageTest\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_GlobalScreenService()

addGlobal_GlobalScreenService ( )
protected

Definition at line 278 of file ilTestBaseTestCaseTrait.php.

278 : void
279 {
280 $this->setGlobalVariable('global_screen', $this->createMock(ILIAS\GlobalScreen\Services::class));
281 }
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), ilTestEvalObjectiveOrientedGUITest\setUp(), ilTestEvaluationGUITest\setUp(), ilTestPlayerRandomQuestionSetGUITest\setUp(), ilTestServiceGUITest\setUp(), and TestScoringByParticipantGUITest\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_http()

addGlobal_http ( )
protected

Definition at line 332 of file ilTestBaseTestCaseTrait.php.

332 : void
333 {
334 $request_mock = $this->getMockBuilder(\Psr\Http\Message\ServerRequestInterface::class)
335 ->disableOriginalConstructor()
336 ->getMock();
337 $request_mock->method('getUri')
338 ->willReturn(new GuzzleURI('http://wwww.ilias.de'));
339 $http_mock = $this->getMockBuilder(HTTPServices::class)->disableOriginalConstructor()
340 ->getMock();
341 $http_mock->method('request')
342 ->willReturn($request_mock);
343 $this->setGlobalVariable('http', $http_mock);
344 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), ilObjTestVerificationGUITest\setUp(), ilTestRandomQuestionSetConfigGUITest\setUp(), ILIAS\Test\Tests\Questions\Presentation\QuestionsOfAttemptTableTest\setUp(), ILIAS\Test\Tests\Questions\Presentation\QuestionsTableTest\setUp(), and assBaseTestCase\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_ilAccess()

addGlobal_ilAccess ( )
protected

Definition at line 175 of file ilTestBaseTestCaseTrait.php.

175 : void
176 {
177 $this->setGlobalVariable('ilAccess', $this->createMock(ilAccess::class));
178 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), ilObjTestAccessTest\setUp(), ilObjTestListGUITest\setUp(), ilObjTestVerificationGUITest\setUp(), ilObjTestVerificationListGUITest\setUp(), ilTestAccessTest\setUp(), ilTestParticipantsGUITest\setUp(), Test\tests\ilTestQuestionPoolSelectorExplorerTest\setUp(), and assBaseTestCase\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_ilAppEventHandler()

addGlobal_ilAppEventHandler ( )
protected

Definition at line 288 of file ilTestBaseTestCaseTrait.php.

288 : void
289 {
290 $this->setGlobalVariable('ilAppEventHandler', $this->createMock(ilAppEventHandler::class));
291 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), ilObjTestFolderTest\setUp(), ilObjTestTest\setUp(), ilObjTestVerificationTest\setUp(), ilTestTaxonomyTreeTest\setUp(), and ilObjQuestionPoolTest\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_ilBench()

addGlobal_ilBench ( )
protected

Definition at line 258 of file ilTestBaseTestCaseTrait.php.

258 : void
259 {
260 $this->setGlobalVariable('ilBench', $this->createMock(ilBenchmark::class));
261 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), and ilObjQuestionPoolTest\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_ilComponentFactory()

addGlobal_ilComponentFactory ( )
protected

Definition at line 303 of file ilTestBaseTestCaseTrait.php.

303 : void
304 {
305 $this->setGlobalVariable('component.factory', $this->createMock(ilComponentFactory::class));
306 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), ilObjTestTest\setUp(), ilTestParticipantsGUITest\setUp(), and assBaseTestCase\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_ilComponentRepository()

addGlobal_ilComponentRepository ( )
protected

Definition at line 298 of file ilTestBaseTestCaseTrait.php.

298 : void
299 {
300 $this->setGlobalVariable('component.repository', $this->createMock(ilComponentRepository::class));
301 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), and assBaseTestCase\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_ilCtrl()

addGlobal_ilCtrl ( )
protected

Definition at line 215 of file ilTestBaseTestCaseTrait.php.

215 : void
216 {
217 $this->setGlobalVariable('ilCtrl', $this->createMock(ilCtrl::class));
218 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), ilTestRandomQuestionSetConfigGUITest\setUp(), ILIAS\Test\Tests\Questions\Presentation\QuestionsOfAttemptTableTest\setUp(), Results\Toplist\DataRetrievalTest\setUp(), and assBaseTestCase\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_ilDB()

addGlobal_ilDB ( )
protected

Definition at line 240 of file ilTestBaseTestCaseTrait.php.

240 : void
241 {
242 $db = $this->createMock(ilDBInterface::class);
243 $db
244 ->method('loadModule')
245 ->willReturnCallback(
246 function ($module): ilDBPdoManager|ilDBPdoReverse|null {
247 return match ($module) {
248 ilDBConstants::MODULE_MANAGER => $this->createMock(ilDBPdoManager::class),
249 ilDBConstants::MODULE_REVERSE => $this->createMock(ilDBPdoReverse::class),
250 default => null
251 };
252 }
253 );
254
255 $this->setGlobalVariable('ilDB', $db);
256 }
Class ilDBPdoManager.
Class ilDBPdoReverse.

References ilDBConstants\MODULE_MANAGER, ilDBConstants\MODULE_REVERSE, and setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), ilCronFinishUnfinishedTestPassesTest\setUp(), ilObjTestFolderTest\setUp(), ilObjTestVerificationTest\setUp(), assBaseTestCase\setUp(), and ilTestSkillLevelThresholdXmlParserTest\testInitSkillLevelThresholdImportList().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_ilErr()

◆ addGlobal_ilHelp()

addGlobal_ilHelp ( )
protected

Definition at line 356 of file ilTestBaseTestCaseTrait.php.

356 : void
357 {
358 $this->setGlobalVariable('ilHelp', $this->createMock(ilHelpGUI::class));
359 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), ilTestEvalObjectiveOrientedGUITest\setUp(), ilTestEvaluationGUITest\setUp(), ilTestPlayerRandomQuestionSetGUITest\setUp(), ilTestServiceGUITest\setUp(), TestScoringByParticipantGUITest\setUp(), and assBaseTestCase\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_ilias()

addGlobal_ilias ( )
protected

Definition at line 268 of file ilTestBaseTestCaseTrait.php.

268 : void
269 {
270 $this->setGlobalVariable('ilias', $this->getIliasMock());
271 }

References getIliasMock(), and setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), ILIAS\Test\Tests\ExportFixedQuestionSetTest\setUp(), ilObjTestFolderTest\setUp(), ilObjTestVerificationTest\setUp(), ilObjQuestionPoolTest\setUp(), and ilQuestionpoolExportTest\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_ilIliasIniFile()

addGlobal_ilIliasIniFile ( )
protected

Definition at line 346 of file ilTestBaseTestCaseTrait.php.

346 : void
347 {
348 $this->setGlobalVariable('ilIliasIniFile', $this->createMock(ilIniFile::class));
349 }

References setGlobalVariable().

Referenced by assBaseTestCase\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_ilLocator()

addGlobal_ilLocator ( )
protected

Definition at line 318 of file ilTestBaseTestCaseTrait.php.

318 : void
319 {
320 $this->setGlobalVariable('ilLocator', $this->createMock(ilLocatorGUI::class));
321 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), and ilObjTestVerificationGUITest\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_ilLog()

◆ addGlobal_ilLoggerFactory()

addGlobal_ilLoggerFactory ( )
protected

Definition at line 351 of file ilTestBaseTestCaseTrait.php.

351 : void
352 {
353 $this->setGlobalVariable('ilLoggerFactory', $this->createMock(ilLoggerFactory::class));
354 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), ilECSTestSettingsTest\setUp(), ilObjTestListGUITest\setUp(), ilObjTestVerificationListGUITest\setUp(), ilObjQuestionPoolListGUITest\setUp(), and ilQuestionPageParserTest\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_ilNavigationHistory()

addGlobal_ilNavigationHistory ( )
protected

Definition at line 283 of file ilTestBaseTestCaseTrait.php.

283 : void
284 {
285 $this->setGlobalVariable('ilNavigationHistory', $this->createMock(ilNavigationHistory::class));
286 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), ilTestEvalObjectiveOrientedGUITest\setUp(), ilTestEvaluationGUITest\setUp(), ilTestPlayerRandomQuestionSetGUITest\setUp(), ilTestServiceGUITest\setUp(), TestScoringByParticipantGUITest\setUp(), and ilObjQuestionPoolGUITest\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_ilObjDataCache()

◆ addGlobal_ilRbacAdmin()

addGlobal_ilRbacAdmin ( )
protected

Definition at line 210 of file ilTestBaseTestCaseTrait.php.

210 : void
211 {
212 $this->setGlobalVariable('rbacadmin', $this->createMock(ilRbacAdmin::class));
213 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), ilECSTestSettingsTest\setUp(), and ilObjTestVerificationGUITest\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_ilSetting()

◆ addGlobal_ilTabs()

◆ addGlobal_ilToolbar()

◆ addGlobal_ilUser()

◆ addGlobal_lng()

addGlobal_lng ( )
protected

◆ addGlobal_objDefinition()

addGlobal_objDefinition ( )
protected

Definition at line 190 of file ilTestBaseTestCaseTrait.php.

190 : void
191 {
192 $this->setGlobalVariable('objDefinition', $this->createMock(ilObjectDefinition::class));
193 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), ilObjTestFolderTest\setUp(), ilObjTestVerificationTest\setUp(), ilAssGenFeedbackPageTest\setUp(), ilAssQuestionPageTest\setUp(), ilAssSpecFeedbackPageTest\setUp(), ilObjQuestionPoolListGUITest\setUp(), ilObjQuestionPoolTest\setUp(), ilQuestionUsagesTableGUITest\setUp(), and ilSolutionExplorerTest\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_objectMetadata()

addGlobal_objectMetadata ( )
protected

Definition at line 388 of file ilTestBaseTestCaseTrait.php.

388 : void
389 {
390 $this->setGlobalVariable('learning_object_metadata', $this->createMock(ILIAS\MetaData\Services\ServicesInterface::class));
391 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), and assBaseTestCase\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_objectService()

addGlobal_objectService ( )
protected

Definition at line 393 of file ilTestBaseTestCaseTrait.php.

393 : void
394 {
395 $this->setGlobalVariable('object.customicons.factory', $this->getMockBuilder(ILIAS\ILIASObject\Properties\AdditionalProperties\Icon\Factory::class)->disableOriginalConstructor()->getMock());
396 $object_mock = $this->getMockBuilder(\ilObjectService::class)->disableOriginalConstructor()->getMock();
397
398 $this->setGlobalVariable('object', $object_mock);
399 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), and assBaseTestCase\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_rbacreview()

addGlobal_rbacreview ( )
protected

Definition at line 323 of file ilTestBaseTestCaseTrait.php.

323 : void
324 {
325 $this->setGlobalVariable('rbacreview', $this->createMock(ilRbacReview::class));
326 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), ilObjTestListGUITest\setUp(), ilObjTestVerificationGUITest\setUp(), ilObjTestVerificationListGUITest\setUp(), and assBaseTestCase\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_rbacsystem()

addGlobal_rbacsystem ( )
protected

◆ addGlobal_refinery()

addGlobal_refinery ( )
protected

Definition at line 376 of file ilTestBaseTestCaseTrait.php.

376 : void
377 {
378 $refineryMock = $this->getMockBuilder(RefineryFactory::class)->disableOriginalConstructor()->getMock();
379 $refineryMock->expects(self::any())->method('random')->willReturn($this->getMockBuilder(RandomGroup::class)->getMock());
380 $this->setGlobalVariable('refinery', $refineryMock);
381 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), ilTestPlayerRandomQuestionSetGUITest\setUp(), ILIAS\Test\Tests\Questions\Presentation\QuestionsTableTest\setUp(), and assBaseTestCase\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_resourceStorage()

addGlobal_resourceStorage ( )
protected

Definition at line 401 of file ilTestBaseTestCaseTrait.php.

401 : void
402 {
403 $this->setGlobalVariable('resource_storage', $this->createMock(\ILIAS\ResourceStorage\Services::class));
404 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), ILIAS\Test\Tests\ExportFixedQuestionSetTest\setUp(), ILIAS\Test\Tests\ExportImport\ExportRandomQuestionSetTest\setUp(), assBaseTestCase\setUp(), assFileUploadFileTableGUITest\setUp(), and ilAssFileUploadUploadsExporterTest\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_skillService()

addGlobal_skillService ( )
protected

Definition at line 383 of file ilTestBaseTestCaseTrait.php.

383 : void
384 {
385 $this->setGlobalVariable('skill', $this->createMock(ILIAS\Skill\Service\SkillService::class));
386 }

References setGlobalVariable().

+ Here is the call graph for this function:

◆ addGlobal_static_url()

addGlobal_static_url ( )
protected

Definition at line 230 of file ilTestBaseTestCaseTrait.php.

230 : void
231 {
232 $this->setGlobalVariable('static_url', $this->createMock(ILIAS\StaticURL\Services::class));
233 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), and assBaseTestCase\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_tpl()

addGlobal_tpl ( )
protected

Definition at line 293 of file ilTestBaseTestCaseTrait.php.

293 : void
294 {
295 $this->setGlobalVariable('tpl', $this->createMock(ilGlobalPageTemplate::class));
296 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), MarkSchemaGUITest\setUp(), and assBaseTestCase\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_tree()

addGlobal_tree ( )
protected

Definition at line 195 of file ilTestBaseTestCaseTrait.php.

195 : void
196 {
197 $this->setGlobalVariable('tree', $this->createMock(ilTree::class));
198 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), ilObjTestFolderTest\setUp(), ilObjTestVerificationTest\setUp(), ilTestRandomQuestionSetConfigGUITest\setUp(), and assBaseTestCase\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_uiFactory()

addGlobal_uiFactory ( )
protected

Definition at line 366 of file ilTestBaseTestCaseTrait.php.

366 : void
367 {
368 $this->setGlobalVariable('ui.factory', $this->createMock(FactoryInternal::class));
369 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), ILIAS\Test\Tests\Questions\Presentation\QuestionsTableTest\setUp(), assBaseTestCase\setUp(), assClozeTestGUITest\setUp(), assFormulaQuestionGUITest\setUp(), assLongMenuGUITest\setUp(), ilAnswerWizardInputGUITest\setUp(), ilAssAnswerCorrectionsInputGUITest\setUp(), ilAssClozeTestCombinationVariantsInputGUITest\setUp(), ilAssLongmenuCorrectionsInputGUITest\setUp(), ilAssMatchingPairCorrectionsInputGUITest\setUp(), ilAssMultipleChoiceCorrectionsInputGUITest\setUp(), ilAssOrderingImagesInputGUITest\setUp(), ilAssOrderingTextsInputGUITest\setUp(), ilAssQuestionSkillAssignmentPropertyFormGUITest\setUp(), ilAssSingleChoiceCorrectionsInputGUITest\setUp(), ilEssayKeywordWizardInputGUITest\setUp(), ilGlobalUnitCategoryTableGUITest\setUp(), ilImagemapCorrectionsInputGUITest\setUp(), ilImagemapFileInputGUITest\setUp(), ilKprimChoiceCorrectionsInputGUITest\setUp(), ilKprimChoiceWizardInputGUITest\setUp(), ilLocalUnitCategoryTableGUITest\setUp(), ilLogicalAnswerComparisonExpressionInputGUITest\setUp(), ilMatchingPairWizardInputGUITest\setUp(), ilMatchingWizardInputGUITest\setUp(), ilMultipleChoiceWizardInputGUITest\setUp(), ilMultipleImagesInputGUITest\setUp(), ilMultipleTextsInputGUITest\setUp(), ilQuestionBrowserTableGUITest\setUp(), ilSingleChoiceWizardInputGUITest\setUp(), ilUnitCategoryTableGUITest\setUp(), and ilUnitTableGUITest\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_uiRenderer()

addGlobal_uiRenderer ( )
protected

Definition at line 371 of file ilTestBaseTestCaseTrait.php.

371 : void
372 {
373 $this->setGlobalVariable('ui.renderer', $this->createMock(ILIAS\UI\Implementation\DefaultRenderer::class));
374 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), assBaseTestCase\setUp(), assClozeTestGUITest\setUp(), assFormulaQuestionGUITest\setUp(), assLongMenuGUITest\setUp(), ilAnswerWizardInputGUITest\setUp(), ilAssAnswerCorrectionsInputGUITest\setUp(), ilAssClozeTestCombinationVariantsInputGUITest\setUp(), ilAssLongmenuCorrectionsInputGUITest\setUp(), ilAssMatchingPairCorrectionsInputGUITest\setUp(), ilAssMultipleChoiceCorrectionsInputGUITest\setUp(), ilAssOrderingImagesInputGUITest\setUp(), ilAssOrderingTextsInputGUITest\setUp(), ilAssQuestionSkillAssignmentPropertyFormGUITest\setUp(), ilAssSingleChoiceCorrectionsInputGUITest\setUp(), ilEssayKeywordWizardInputGUITest\setUp(), ilGlobalUnitCategoryTableGUITest\setUp(), ilImagemapCorrectionsInputGUITest\setUp(), ilImagemapFileInputGUITest\setUp(), ilKprimChoiceCorrectionsInputGUITest\setUp(), ilKprimChoiceWizardInputGUITest\setUp(), ilLocalUnitCategoryTableGUITest\setUp(), ilLogicalAnswerComparisonExpressionInputGUITest\setUp(), ilMatchingPairWizardInputGUITest\setUp(), ilMatchingWizardInputGUITest\setUp(), ilMultipleChoiceWizardInputGUITest\setUp(), ilMultipleImagesInputGUITest\setUp(), ilMultipleTextsInputGUITest\setUp(), ilQuestionBrowserTableGUITest\setUp(), ilSingleChoiceWizardInputGUITest\setUp(), ilUnitCategoryTableGUITest\setUp(), and ilUnitTableGUITest\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_uiService()

addGlobal_uiService ( )
protected

Definition at line 361 of file ilTestBaseTestCaseTrait.php.

361 : void
362 {
363 $this->setGlobalVariable('uiService', $this->createMock(\ilUIService::class));
364 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_uiUploadLimitResolver()

◆ addGlobal_upload()

addGlobal_upload ( )
protected

Definition at line 235 of file ilTestBaseTestCaseTrait.php.

235 : void
236 {
237 $this->setGlobalVariable('upload', $this->createMock(FileUpload::class));
238 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), and assBaseTestCase\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_user()

addGlobal_user ( )
protected

Definition at line 414 of file ilTestBaseTestCaseTrait.php.

414 : void
415 {
416 $this->setGlobalVariable(
417 'user',
418 $this->createMock(PublicInterface::class)
419 );
420 }

References setGlobalVariable().

Referenced by ilTestBaseTestCase\addGlobals(), ilObjTestListGUITest\setUp(), ilObjTestVerificationListGUITest\setUp(), and ilObjQuestionPoolListGUITest\setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildLocalDICMock()

buildLocalDICMock ( )
protected

Definition at line 460 of file ilTestBaseTestCaseTrait.php.

461 {
462 $local_dic_mock = $this->getMockBuilder(ILIAS\Test\TestDIC::class)
463 ->onlyMethods([])->getMock();
464 $local_dic_mock['question.general_properties.repository'] = fn(Pimple\Container $c)
465 => $this->createMock(
466 ILIAS\TestQuestionPool\Questions\GeneralQuestionPropertiesRepository::class
467 );
468 $local_dic_mock['request_data_collector'] = fn(Pimple\Container $c)
469 => $this->createMock(
470 \ILIAS\Test\RequestDataCollector::class
471 );
472 $local_dic_mock['participant.access_filter.factory'] = fn(Pimple\Container $c)
473 => $this->createMock(
474 \ilTestParticipantAccessFilterFactory::class
475 );
476 $local_dic_mock['logging.logger'] = fn(Pimple\Container $c)
477 => $this->createMock(
478 \ILIAS\Test\Logging\TestLogger::class
479 );
480 $local_dic_mock['logging.viewer'] = fn(Pimple\Container $c)
481 => $this->createMock(
482 \ILIAS\Test\Logging\TestLogViewer::class
483 );
484 $local_dic_mock['shuffler'] = fn(Pimple\Container $c)
485 => $this->createMock(
486 \ilTestShuffler::class
487 );
488 $local_dic_mock['results.presentation.factory'] = fn(Pimple\Container $c)
489 => $this->createMock(
490 ILIAS\Test\Results\Presentation\Factory::class
491 );
492 $local_dic_mock['results.data.factory'] = fn(Pimple\Container $c)
493 => $this->createMock(
494 ILIAS\Test\Results\Data\Factory::class
495 );
496 $local_dic_mock['results.toplist.repository'] = fn(Pimple\Container $c)
497 => $this->createMock(
498 ILIAS\Test\Results\Toplist\TestTopListRepository::class
499 );
500 $local_dic_mock['results.data.repository'] = fn(Pimple\Container $c)
501 => $this->createMock(
502 \ILIAS\Test\Results\Data\Repository::class
503 );
504 $local_dic_mock['questions.properties.repository'] = fn(Pimple\Container $c)
505 => $this->createMock(
506 ILIAS\Test\Questions\Properties\Repository::class
507 );
508 return $local_dic_mock;
509 }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
$c
Definition: deliver.php:25

References $c.

Referenced by getTestObjMock().

+ Here is the caller graph for this function:

◆ defineGlobalConstants()

defineGlobalConstants ( )
protected

Definition at line 95 of file ilTestBaseTestCaseTrait.php.

95 : void
96 {
97 if (!defined('ILIAS_HTTP_PATH')) {
98 define('ILIAS_HTTP_PATH', 'http://localhost');
99 }
100 if (!defined('CLIENT_DATA_DIR')) {
101 define('CLIENT_DATA_DIR', '/var/iliasdata');
102 }
103 if (!defined('IL_INST_ID')) {
104 define('IL_INST_ID', '0');
105 }
106 if (!defined('ANONYMOUS_USER_ID')) {
107 define('ANONYMOUS_USER_ID', 13);
108 }
109 if (!defined('ANONYMOUS_USER_ID')) {
110 define('ANONYMOUS_USER_ID', 13);
111 }
112 if (!defined('ROOT_FOLDER_ID')) {
113 define('ROOT_FOLDER_ID', 8);
114 }
115 if (!defined('ILIAS_LOG_ENABLED')) {
116 define('ILIAS_LOG_ENABLED', true);
117 }
118 if (!defined('ILIAS_LOG_DIR')) {
119 define('ILIAS_LOG_DIR', '/var/log');
120 }
121 if (!defined('ILIAS_LOG_FILE')) {
122 define('ILIAS_LOG_FILE', '/var/log/ilias.log');
123 }
124 }

Referenced by ilTestBaseTestCase\addGlobals(), ilTestBaseTestCase\setUp(), and assBaseTestCase\setUp().

+ Here is the caller graph for this function:

◆ expectRedirect()

expectRedirect ( InvocationOrder  $expects,
string  $method 
)

Definition at line 541 of file ilTestBaseTestCaseTrait.php.

541 : void
542 {
543 $this->dic['ilCtrl']->expects($expects)->method('redirect')->with($this->anything(), $this->equalTo($method));
544 }

◆ expectTplContent()

expectTplContent ( mixed  $expected_content)
protected

Expect that the template content will be set to the specified expected content.

Definition at line 531 of file ilTestBaseTestCaseTrait.php.

531 : void
532 {
533 $this->dic['tpl']->expects($this->once())->method('setContent')->with($expected_content);
534 }

◆ getDatabaseMock()

◆ getFileDelivery()

getFileDelivery ( )
protected

Definition at line 427 of file ilTestBaseTestCaseTrait.php.

428 {
429 $data_signer = new ILIAS\FileDelivery\Token\DataSigner(
430 new ILIAS\FileDelivery\Token\Signer\Key\Secret\SecretKeyRotation(
431 new ILIAS\FileDelivery\Token\Signer\Key\Secret\SecretKey('blup')
432 )
433 );
434 $http_mock = $this->createMock(HTTPServices::class);
435 $response_builder_mock = $this->createMock(\ILIAS\FileDelivery\Delivery\ResponseBuilder\ResponseBuilder::class);
436 return new \ILIAS\FileDelivery\Services(
437 new ILIAS\FileDelivery\Delivery\StreamDelivery(
438 $data_signer,
439 $http_mock,
440 $response_builder_mock,
441 $response_builder_mock
442 ),
443 new \ILIAS\FileDelivery\Delivery\LegacyDelivery(
444 $http_mock,
445 $response_builder_mock,
446 $response_builder_mock
447 ),
448 $data_signer,
449 $http_mock
450 );
451 }
Token
The string representation of these tokens must not occur in the names of metadata elements.
Definition: Token.php:28

Referenced by addGlobal_fileDelivery(), assFileUploadGUITest\setUp(), and assFileUploadTest\setUp().

+ Here is the caller graph for this function:

◆ getGlobalTemplateMock()

getGlobalTemplateMock ( )
protected
Returns
ilTemplate|mixed|MockObject

Definition at line 145 of file ilTestBaseTestCaseTrait.php.

146 {
147 return $this->createMock(ilTemplate::class);
148 }

◆ getIliasMock()

◆ getTestObjMock()

getTestObjMock ( )
protected

Definition at line 453 of file ilTestBaseTestCaseTrait.php.

453 : ilObjTest
454 {
455 return $this->createConfiguredMock(ilObjTest::class, [
456 'getLocalDIC' => $this->buildLocalDICMock()
457 ]);
458 }

References buildLocalDICMock().

Referenced by ILIAS\Test\Tests\ExportImport\ExportRandomQuestionSetTest\setUp(), ilTestRandomQuestionSetPoolDefinitionFormGUITest\setUp(), ilAssQuestionPageCommandForwarderTest\setUp(), ilMyTestResultsGUITest\setUp(), ilMyTestSolutionsGUITest\setUp(), ilTestArchiveServiceTest\setUp(), ilTestEvalObjectiveOrientedGUITest\setUp(), ilTestEvaluationGUITest\setUp(), ilTestFixedQuestionSetConfigTest\setUp(), ilTestGradingMessageBuilderTest\setUp(), ilTestParticipantListTest\setUp(), ilTestParticipantsGUITest\setUp(), ilTestPassesSelectorTest\setUp(), ilTestPasswordCheckerTest\setUp(), ilTestPlayerFactoryTest\setUp(), ilTestPlayerRandomQuestionSetGUITest\setUp(), ilTestQuestionSetConfigFactoryTest\setUp(), ilTestRandomQuestionSetConfigGUITest\setUp(), ilTestRandomQuestionSetSourcePoolDefinitionFactoryTest\setUp(), ilTestRandomQuestionSetSourcePoolDefinitionListTest\setUp(), ilTestRandomQuestionSetSourcePoolDefinitionTest\setUp(), ilTestRandomQuestionSetStagingPoolBuilderTest\setUp(), ilTestResultsGUITest\setUp(), ilTestServiceGUITest\setUp(), ilTestServiceTest\setUp(), ilTestSessionFactoryTest\setUp(), ilTestSkillAdministrationGUITest\setUp(), ilTestSkillEvaluationGUITest\setUp(), ilTestToplistGUITest\setUp(), ilTestVirtualSequenceRandomQuestionSetTest\setUp(), ilTestVirtualSequenceTest\setUp(), ILIAS\Test\Tests\Presentation\TabsManagerTest\setUp(), ILIAS\Test\Tests\Questions\Presentation\QuestionsOfAttemptTableTest\setUp(), MarkSchemaGUITest\setUp(), Results\Toplist\DataRetrievalTest\setUp(), ilResultsByQuestionTableGUITest\setUp(), ilTestPassDetailsOverviewTableGUITest\setUp(), ilTestPassOverviewTableGUITest\setUp(), ilTestPersonalDefaultSettingsTableGUITest\setUp(), ilTestQuestionBrowserTableGUITest\setUp(), ilTestSkillLevelThresholdsTableGUITest\setUp(), TestScoringByParticipantPassesOverviewTableGUITest\setUp(), TestScoringByParticipantTableGUITest\setUp(), TestScoringByParticipantGUITest\setUp(), TestScoringTest\setUp(), ilTestInfoScreenToolbarGUITest\setUp(), ilTestRandomQuestionSetSourcePoolDefinitionListTest\testAddDefinition(), ILIAS\Test\Tests\ExportImport\ResultsExportExcelTest\testConstruct(), ILIAS\Test\Tests\Presentation\TestScreenGUITest\testConstruct(), ilTestRandomQuestionSetSourcePoolDefinitionListTest\testGetDefinition(), ilTestRandomQuestionSetSourcePoolDefinitionListTest\testGetDefinitionBySourcePoolId(), ilTestRandomQuestionSetSourcePoolDefinitionListTest\testGetDefinitionCount(), ilTestRandomQuestionSetSourcePoolDefinitionListTest\testGetDefinitionIds(), ilTestRandomQuestionSetSourcePoolDefinitionListTest\testHasDefinition(), SettingsScoringGUITest\testScoringResultsGUIConstruct(), and ilObjTestXMLParserTest\testTestOBJ().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mockCommand()

mockCommand ( string  $command)

Definition at line 536 of file ilTestBaseTestCaseTrait.php.

536 : void
537 {
538 $this->dic['ilCtrl']->method('getCmd')->willReturn($command);
539 }

◆ mockGetRequest()

mockGetRequest ( array  $query_parameters = [])

Definition at line 551 of file ilTestBaseTestCaseTrait.php.

551 : void
552 {
553 $this->mockRequest('GET', [], $query_parameters);
554 }
mockRequest(string $request_method, array $properties, array $query_parameters)

References mockRequest().

+ Here is the call graph for this function:

◆ mockPostRequest()

mockPostRequest ( array  $properties,
array  $query_parameters = [] 
)

Definition at line 546 of file ilTestBaseTestCaseTrait.php.

546 : void
547 {
548 $this->mockRequest('POST', $properties, $query_parameters);
549 }

References mockRequest().

+ Here is the call graph for this function:

◆ mockRequest()

mockRequest ( string  $request_method,
array  $properties,
array  $query_parameters 
)
private

Definition at line 556 of file ilTestBaseTestCaseTrait.php.

556 : void
557 {
558 $_SERVER['REQUEST_METHOD'] = $request_method;
559 $request = $this->createConfiguredMock(ServerRequestInterface::class, [
560 'getServerParams' => ['REQUEST_METHOD' => $request_method],
561 'getParsedBody' => $properties,
562 'getQueryParams' => $query_parameters
563 ]);
564 $this->dic['http']->method('request')->willReturn($request);
565 $this->dic['http']->method('wrapper')->willReturn(new WrapperFactory($request));
566 }
$_SERVER['HTTP_HOST']
Definition: raiseError.php:26

References $_SERVER.

Referenced by mockGetRequest(), and mockPostRequest().

+ Here is the caller graph for this function:

◆ setGlobalVariable()

setGlobalVariable ( string  $name,
mixed  $value 
)
protected
Parameters
string$name
mixed$value

Definition at line 130 of file ilTestBaseTestCaseTrait.php.

130 : void
131 {
132 global $DIC;
133
134 $GLOBALS[$name] = $value;
135
136 unset($DIC[$name]);
137 $DIC[$name] = static function (Container $c) use ($value) {
138 return $value;
139 };
140 }
$GLOBALS["DIC"]
Definition: wac.php:54

References $c, $DIC, and $GLOBALS.

Referenced by addGlobal_dataFactory(), addGlobal_fileDelivery(), addGlobal_filesystem(), addGlobal_GlobalScreenService(), addGlobal_http(), addGlobal_ilAccess(), addGlobal_ilAppEventHandler(), addGlobal_ilBench(), addGlobal_ilComponentFactory(), addGlobal_ilComponentRepository(), addGlobal_ilCtrl(), addGlobal_ilDB(), addGlobal_ilErr(), addGlobal_ilHelp(), addGlobal_ilias(), addGlobal_ilIliasIniFile(), addGlobal_ilLocator(), addGlobal_ilLog(), addGlobal_ilLoggerFactory(), addGlobal_ilNavigationHistory(), addGlobal_ilObjDataCache(), addGlobal_ilRbacAdmin(), addGlobal_ilSetting(), addGlobal_ilTabs(), addGlobal_ilToolbar(), addGlobal_ilUser(), addGlobal_lng(), addGlobal_objDefinition(), addGlobal_objectMetadata(), addGlobal_objectService(), addGlobal_rbacreview(), addGlobal_rbacsystem(), addGlobal_refinery(), addGlobal_resourceStorage(), addGlobal_skillService(), addGlobal_static_url(), addGlobal_tpl(), addGlobal_tree(), addGlobal_uiFactory(), addGlobal_uiRenderer(), addGlobal_uiService(), addGlobal_uiUploadLimitResolver(), addGlobal_upload(), addGlobal_user(), ilCertificateDateHelperTest\mockUserLanguageGerman(), ilTestRandomQuestionSetGeneralConfigFormGUITest\setUp(), ilTestRandomQuestionSetPoolDefinitionFormGUITest\setUp(), ilTestTaxonomyTreeTest\setUp(), ilResultsByQuestionTableGUITest\setUp(), ilTestPassDetailsOverviewTableGUITest\setUp(), ilTestPassOverviewTableGUITest\setUp(), ilTestPersonalDefaultSettingsTableGUITest\setUp(), ilTestQuestionBrowserTableGUITest\setUp(), ilTestSkillLevelThresholdsTableGUITest\setUp(), ilTestVerificationTableGUITest\setUp(), TestScoringByParticipantPassesOverviewTableGUITest\setUp(), TestScoringByParticipantTableGUITest\setUp(), ilTestRandomQuestionSetSourcePoolDefinitionListToolbarGUITest\setUp(), ilTestSkillEvaluationToolbarGUITest\setUp(), assClozeGapTest\setUp(), assClozeTestGUITest\setUp(), assClozeTestTest\setUp(), assErrorTextGUITest\setUp(), assErrorTextTest\setUp(), assFileUploadGUITest\setUp(), assFileUploadTest\setUp(), assFormulaQuestionGUITest\setUp(), assFormulaQuestionTest\setUp(), assImagemapQuestionTest\setUp(), assKprimChoiceTest\setUp(), assLongmenuTest\setUp(), assMatchingQuestionGUITest\setUp(), assMatchingQuestionTest\setUp(), assMultipleChoiceGUITest\setUp(), assMultipleChoiceTest\setUp(), assNumericGUITest\setUp(), assNumericTest\setUp(), assOrderingHorizontalGUITest\setUp(), assOrderingHorizontalTest\setUp(), assOrderingQuestionGUITest\setUp(), assOrderingQuestionTest\setUp(), assSingleChoiceGUITest\setUp(), assSingleChoiceTest\setUp(), assTextQuestionGUITest\setUp(), assTextQuestionTest\setUp(), assTextSubsetGUITest\setUp(), assTextSubsetTest\setUp(), ilObjQuestionPoolGUITest\setUp(), RequestValidationHelperTest\setUp(), ilBuddyListTestCase\testAlreadyGivenStateExceptionIsThrownWhenARequestedRelationShouldBeMarkedAsRequested(), ilObjTestGUITest\testCancelCreateQuestionObject(), ilCronFinishUnfinishedTestPassesTest\testGetDescription(), ilCronFinishUnfinishedTestPassesTest\testGetTitle(), assClozeTestGUITest\testInstantiateObjectShouldReturnInstance(), and ilObjTestGUITest\testRunObject().

+ Here is the caller graph for this function:

Variable Documentation

◆ ilTestBaseTestCaseTrait

trait ilTestBaseTestCaseTrait

Definition at line 43 of file ilTestBaseTestCaseTrait.php.