ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 ()
 
 getIRSSMock ()
 
 getFileDeliveryMock ()
 
 getIliasMock ()
 
 addGlobal_uiFactory ()
 
 addGlobal_uiRenderer ()
 

Protected Attributes

Container $dic = null
 

Detailed Description

Class assBaseTestCase.

Definition at line 29 of file assBaseTestCase.php.

Member Function Documentation

◆ addGlobal_uiFactory()

assBaseTestCase::addGlobal_uiFactory ( )
protected

Definition at line 148 of file assBaseTestCase.php.

References setGlobalVariable().

Referenced by assClozeTestGUITest\setUp().

148  : void
149  {
150  $this->setGlobalVariable("ui.factory", $this->createMock(Factory::class));
151  }
setGlobalVariable(string $name, $value)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlobal_uiRenderer()

assBaseTestCase::addGlobal_uiRenderer ( )
protected

Definition at line 153 of file assBaseTestCase.php.

References setGlobalVariable().

Referenced by assClozeTestGUITest\setUp().

153  : void
154  {
155  $this->setGlobalVariable("ui.renderer", $this->createMock(ILIAS\UI\Implementation\DefaultRenderer::class));
156  }
Class ChatMainBarProvider .
setGlobalVariable(string $name, $value)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDatabaseMock()

◆ getFileDeliveryMock()

assBaseTestCase::getFileDeliveryMock ( )
protected

Definition at line 130 of file assBaseTestCase.php.

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

131  {
132  return $this->getMockBuilder(\ILIAS\FileDelivery\Services::class)->disableOriginalConstructor()->getMock();
133  }
Class ChatMainBarProvider .
+ Here is the caller graph for this function:

◆ getGlobalTemplateMock()

◆ getIliasMock()

◆ getIRSSMock()

assBaseTestCase::getIRSSMock ( )
protected

Definition at line 126 of file assBaseTestCase.php.

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

127  {
128  return $this->getMockBuilder(Services::class)->disableOriginalConstructor()->getMock();
129  }
+ Here is the caller graph for this function:

◆ setGlobalVariable()

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

Definition at line 105 of file assBaseTestCase.php.

References Vendor\Package\$c, $DIC, and $GLOBALS.

Referenced by addGlobal_uiFactory(), addGlobal_uiRenderer(), assKprimChoiceTest\setUp(), assTextQuestionTest\setUp(), assClozeTestGUITest\setUp(), assErrorTextGUITest\setUp(), assMatchingQuestionGUITest\setUp(), assTextSubsetTest\setUp(), assOrderingQuestionGUITest\setUp(), assErrorTextTest\setUp(), assOrderingHorizontalGUITest\setUp(), assNumericTest\setUp(), assMatchingQuestionTest\setUp(), assFileUploadGUITest\setUp(), assNumericGUITest\setUp(), assFileUploadTest\setUp(), assTextSubsetGUITest\setUp(), assFormulaQuestionGUITest\setUp(), assClozeTestTest\setUp(), assTextQuestionGUITest\setUp(), assOrderingHorizontalTest\setUp(), assOrderingQuestionTest\setUp(), assImagemapQuestionTest\setUp(), assClozeGapTest\setUp(), assSingleChoiceTest\setUp(), assSingleChoiceGUITest\setUp(), assMultipleChoiceGUITest\setUp(), assMultipleChoiceTest\setUp(), assFormulaQuestionTest\setUp(), setUp(), assLongmenuTest\setUp(), and assClozeTestGUITest\testInstantiateObjectShouldReturnInstance().

105  : void
106  {
107  global $DIC;
108 
109  $GLOBALS[$name] = $value;
110 
111  unset($DIC[$name]);
112  $DIC[$name] = static function (Container $c) use ($value) {
113  return $value;
114  };
115  }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
global $DIC
Definition: feed.php:28
$GLOBALS["DIC"]
Definition: wac.php:31
+ Here is the caller graph for this function:

◆ setUp()

assBaseTestCase::setUp ( )
protected

Definition at line 36 of file assBaseTestCase.php.

References $DIC, and setGlobalVariable().

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

◆ tearDown()

assBaseTestCase::tearDown ( )
protected

Definition at line 92 of file assBaseTestCase.php.

References $DIC, and $dic.

92  : void
93  {
94  global $DIC;
95 
96  $DIC = $this->dic;
97 
98  parent::tearDown();
99  }
global $DIC
Definition: feed.php:28

Field Documentation

◆ $dic

Container assBaseTestCase::$dic = null
protected

Definition at line 31 of file assBaseTestCase.php.

Referenced by tearDown().


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