ILIAS  release_8 Revision v8.24
assBaseTestCase Class Reference

Class assBaseTestCase. More...

+ Inheritance diagram for assBaseTestCase:
+ Collaboration diagram for assBaseTestCase:

Protected Member Functions

 setUp ()
 
 tearDown ()
 
 setGlobalVariable (string $name, $value)
 
 getGlobalTemplateMock ()
 
 getDatabaseMock ()
 
 getIliasMock ()
 

Protected Attributes

Container $dic = null
 

Detailed Description

Class assBaseTestCase.

Definition at line 27 of file assBaseTestCase.php.

Member Function Documentation

◆ getDatabaseMock()

◆ getGlobalTemplateMock()

◆ getIliasMock()

◆ setGlobalVariable()

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

Definition at line 97 of file assBaseTestCase.php.

97 : void
98 {
99 global $DIC;
100
101 $GLOBALS[$name] = $value;
102
103 unset($DIC[$name]);
104 $DIC[$name] = static function (Container $c) use ($value) {
105 return $value;
106 };
107 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:32
$c
Definition: cli.php:38
global $DIC
Definition: feed.php:28
if($format !==null) $name
Definition: metadata.php:247

References $c, $DIC, $GLOBALS, and $name.

Referenced by setUp(), assClozeGapTest\setUp(), assClozeTestGUITest\setUp(), assClozeTestTest\setUp(), assErrorTextGUITest\setUp(), assErrorTextTest\setUp(), assFileUploadGUITest\setUp(), assFileUploadTest\setUp(), assFlashQuestionTest\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(), and assTextSubsetTest\setUp().

+ Here is the caller graph for this function:

◆ setUp()

assBaseTestCase::setUp ( )
protected

Reimplemented in assAnswerBinaryStateImageTest, assAnswerBinaryStateTest, assAnswerClozeTest, assAnswerErrorTextTest, assAnswerImagemapTest, assAnswerMatchingDefinitionTest, assAnswerMatchingPairTest, assAnswerMatchingTermTest, assAnswerMatchingTest, assAnswerMultipleResponseImageTest, assAnswerMultipleResponseTest, assAnswerOrderingTest, assAnswerSimpleTest, assAnswerTrueFalseTest, assClozeGapTest, assClozeSelectGapTest, assClozeTestGUITest, assClozeTestTest, assErrorTextGUITest, assErrorTextTest, assFileUploadGUITest, assFileUploadTest, assFlashQuestionTest, assFormulaQuestionGUITest, assFormulaQuestionTest, assImagemapQuestionTest, assKprimChoiceTest, assLongmenuTest, assMatchingQuestionGUITest, assMatchingQuestionTest, assMultipleChoiceGUITest, assMultipleChoiceTest, assNumericGUITest, assNumericRangeTest, assNumericTest, assOrderingHorizontalGUITest, assOrderingHorizontalTest, assOrderingQuestionGUITest, assOrderingQuestionTest, assSingleChoiceGUITest, assSingleChoiceTest, assCHANGEMETest, assTextQuestionGUITest, assTextQuestionTest, assTextSubsetGUITest, assTextSubsetTest, ilAssQuestionHintAbstractTest, ilAssQuestionHintListTest, ilAssQuestionHintRequestStatisticDataTest, ilAssQuestionHintTest, ilAssQuestionHintTrackingTest, and ilAssQuestionSkillAssignmentRegistryTest.

Definition at line 34 of file assBaseTestCase.php.

34 : void
35 {
36 global $DIC;
37
38 $this->dic = is_object($DIC) ? clone $DIC : $DIC;
39
40 $DIC = new Container();
41
42 $lng_mock = $this->getMockBuilder(ilLanguage::class)->disableOriginalConstructor()->onlyMethods(['txt'])->getMock();
43 $lng_mock->expects($this->any())->method('txt')->willReturn('Test');
44 $this->setGlobalVariable('lng', $lng_mock);
45
46 $dataCache_mock = $this->getMockBuilder(ilObjectDataCache::class)->disableOriginalConstructor()->getMock();
47 $this->setGlobalVariable('ilObjDataCache', $dataCache_mock);
48
49 $access_mock = $this->createMock(ilAccessHandler::class);
50 $this->setGlobalVariable('ilAccess', $access_mock);
51
52 $help_mock = $this->getMockBuilder(ilHelpGUI::class)->disableOriginalConstructor()->getMock();
53 $this->setGlobalVariable('ilHelp', $help_mock);
54
55 $user_mock = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->getMock();
56 $this->setGlobalVariable('ilUser', $user_mock);
57
58 $tabs_mock = $this->getMockBuilder(ilTabsGUI::class)->disableOriginalConstructor()->getMock();
59 $this->setGlobalVariable('ilTabs', $tabs_mock);
60
61 $rbacsystem_mock = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->getMock();
62 $this->setGlobalVariable('rbacsystem', $rbacsystem_mock);
63
64 $refineryMock = $this->getMockBuilder(RefineryFactory::class)->disableOriginalConstructor()->getMock();
65 $refineryMock->method('random')->willReturn($this->getMockBuilder(RandomGroup::class)->getMock());
66 $this->setGlobalVariable('refinery', $refineryMock);
67
68 $dbMock = $this->createMock(ilDBInterface::class);
69 $this->setGlobalVariable('ilDB', $dbMock);
70
71 $treeMock = $this->createMock(ilTree::class);
72 $this->setGlobalVariable('tree', $treeMock);
73
74 $repository_mock = $this->createMock(ilComponentRepository::class);
75 $this->setGlobalVariable('component.repository', $repository_mock);
76
77 $this->setGlobalVariable('http', $this->getMockBuilder(ILIAS\HTTP\Services::class)->disableOriginalConstructor()->getMock());
78
79 $this->setGlobalVariable('upload', $this->createMock(ILIAS\FileUpload\FileUpload::class));
80
81 parent::setUp();
82 }
setGlobalVariable(string $name, $value)
Class ChatMainBarProvider \MainMenu\Provider.

References $DIC, and setGlobalVariable().

+ Here is the call graph for this function:

◆ tearDown()

assBaseTestCase::tearDown ( )
protected

Reimplemented in assFormulaQuestionTest.

Definition at line 84 of file assBaseTestCase.php.

84 : void
85 {
86 global $DIC;
87
89
90 parent::tearDown();
91 }

References $DIC, and $dic.

Field Documentation

◆ $dic

Container assBaseTestCase::$dic = null
protected

Definition at line 29 of file assBaseTestCase.php.

Referenced by tearDown().


The documentation for this class was generated from the following file: