ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilRTEBaseTest Class Reference

Class ilRTEBaseTest. More...

+ Inheritance diagram for ilRTEBaseTest:
+ Collaboration diagram for ilRTEBaseTest:

Protected Member Functions

 setUp ()
 
 setGlobalVariable (string $name, $value)
 
 setMocks ()
 

Detailed Description

Member Function Documentation

◆ setGlobalVariable()

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

Definition at line 44 of file ilRTEBaseTest.php.

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

Referenced by setMocks().

44  : void
45  {
46  global $DIC;
47 
48  $GLOBALS[$name] = $value;
49 
50  unset($DIC[$name]);
51  $DIC[$name] = static function ($c) use ($name) {
52  return $GLOBALS[$name];
53  };
54  }
$c
Definition: cli.php:38
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:

◆ setMocks()

ilRTEBaseTest::setMocks ( )
protected

Definition at line 56 of file ilRTEBaseTest.php.

References $http, $lng, and setGlobalVariable().

Referenced by setUp().

56  : void
57  {
58  $tpl_mock = $this->createMock(ilGlobalTemplateInterface::class);
59  $this->setGlobalVariable('tpl', $tpl_mock);
60 
61  $lng = $this
62  ->getMockBuilder(ilLanguage::class)
63  ->disableOriginalConstructor()
64  ->onlyMethods(['txt', 'getInstalledLanguages', 'loadLanguageModule'])
65  ->getMock();
66  $this->setGlobalVariable('lng', $lng);
67 
68  $this->setGlobalVariable(
69  'ilCtrl',
70  $this->getMockBuilder(ilCtrlInterface::class)->disableOriginalConstructor()->getMock()
71  );
72 
73  $this->setGlobalVariable(
74  'ilClientIniFile',
75  $this->getMockBuilder(ilIniFile::class)->disableOriginalConstructor()->getMock()
76  );
77 
78  $this->setGlobalVariable(
79  'ilUser',
80  $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->getMock()
81  );
82 
83  $http = $this
84  ->getMockBuilder(HttpServiceImpl::class)
85  ->disableOriginalConstructor()
86  ->onlyMethods(['agent'])
87  ->getMock();
88  $http
89  ->method('agent')
90  ->willReturn(new AgentDetermination());
91  $this->setGlobalVariable('http', $http);
92  }
setGlobalVariable(string $name, $value)
This library is borrowed from the phpGroupWare API http://www.phpgroupware.org/api Modifications made...
$lng
$http
Definition: raiseError.php:7
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUp()

ilRTEBaseTest::setUp ( )
protected

Definition at line 32 of file ilRTEBaseTest.php.

References $GLOBALS, and setMocks().

32  : void
33  {
34  $GLOBALS['DIC'] = new Container();
35  $this->setMocks();
36 
37  parent::setUp();
38  }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:31
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ Here is the call graph for this function:

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