ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

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

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

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  }
$c
Definition: cli.php:38
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:31
global $DIC
Definition: feed.php:28
if($format !==null) $name
Definition: metadata.php:247
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ Here is the caller graph for this function:

◆ setUp()

assBaseTestCase::setUp ( )
protected

Definition at line 34 of file assBaseTestCase.php.

References $DIC, and setGlobalVariable().

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  }
Class ChatMainBarProvider .
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:31
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 84 of file assBaseTestCase.php.

References $DIC, and $dic.

84  : void
85  {
86  global $DIC;
87 
88  $DIC = $this->dic;
89 
90  parent::tearDown();
91  }
global $DIC
Definition: feed.php:28

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: