ILIAS  trunk Revision v11.0_alpha-1689-g66c127b4ae8
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilRepositoryTreeTest Class Reference
+ Inheritance diagram for ilRepositoryTreeTest:
+ Collaboration diagram for ilRepositoryTreeTest:

Public Member Functions

 testTreeConstruct ()
 
 testInitLanguage ()
 

Protected Member Functions

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

Protected Attributes

Container $dic
 

Detailed Description

Definition at line 24 of file ilRepositoryTreeTest.php.

Member Function Documentation

◆ initRepositoryTreeDependencies()

ilRepositoryTreeTest::initRepositoryTreeDependencies ( )
protected

Definition at line 91 of file ilRepositoryTreeTest.php.

References $dic, $GLOBALS, and setGlobalVariable().

Referenced by setUp().

91  : void
92  {
93  $this->dic = new Container();
94  $GLOBALS['DIC'] = $this->dic;
95 
96  $this->setGlobalVariable('ilDB', $this->createMock(ilDBInterface::class));
97  $this->setGlobalVariable('ilAppEventHandler', $this->createMock(ilAppEventHandler::class));
98 
99  $logger = $this->getMockBuilder(ilLogger::class)
100  ->disableOriginalConstructor()
101  ->getMock();
102 
103  $logger_factory = $this->getMockBuilder(ilLoggerFactory::class)
104  ->disableOriginalConstructor()
105  ->onlyMethods(['getComponentLogger'])
106  ->getMock();
107  $logger_factory->method('getComponentLogger')->willReturn($logger);
108  $this->setGlobalVariable('ilLoggerFactory', $logger_factory);
109  }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
$GLOBALS["DIC"]
Definition: wac.php:53
setGlobalVariable(string $name, $value)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setGlobalVariable()

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

Definition at line 80 of file ilRepositoryTreeTest.php.

References $c, $DIC, and $GLOBALS.

Referenced by initRepositoryTreeDependencies(), and testInitLanguage().

80  : void
81  {
82  global $DIC;
83 
84  $GLOBALS[$name] = $value;
85  unset($DIC[$name]);
86  $DIC[$name] = static function (\ILIAS\DI\Container $c) use ($value) {
87  return $value;
88  };
89  }
$c
Definition: deliver.php:25
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
$GLOBALS["DIC"]
Definition: wac.php:53
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ setUp()

ilRepositoryTreeTest::setUp ( )
protected

Definition at line 28 of file ilRepositoryTreeTest.php.

References initRepositoryTreeDependencies().

28  : void
29  {
31  parent::setUp();
32  if (!defined("ROOT_FOLDER_ID")) {
33  define("ROOT_FOLDER_ID", 8);
34  }
35  if (!defined("ILIAS_LOG_ENABLED")) {
36  define("ILIAS_LOG_ENABLED", false);
37  }
38  if (!defined("ILIAS_LOG_DIR")) {
39  define("ILIAS_LOG_DIR", '/var/log');
40  }
41  if (!defined("ILIAS_LOG_FILE")) {
42  define("ILIAS_LOG_FILE", '/var/log/ilias.log');
43  }
44  }
+ Here is the call graph for this function:

◆ testInitLanguage()

ilRepositoryTreeTest::testInitLanguage ( )

Definition at line 52 of file ilRepositoryTreeTest.php.

References setGlobalVariable().

52  : void
53  {
54  // no global user available
55  $tree = new ilTree(1);
56  $tree->initLangCode();
57  $tree_reflection = new ReflectionProperty($tree, 'lang_code');
58  $tree_reflection->setAccessible(true);
59  $this->assertEquals('en', $tree_reflection->getValue($tree));
60 
61  // user getCurrentLanguage() from session is empty
62  $tree = new ilTree(1);
63 
64  $user = $this->getMockBuilder(ilObjUser::class)
65  ->disableOriginalConstructor()
66  ->onlyMethods(['getCurrentLanguage'])
67  ->getMock();
68  $user->method('getCurrentLanguage')->willReturn('');
69  $this->setGlobalVariable('ilUser', $user);
70  $tree->initLangCode();
71  $tree_reflection = new ReflectionProperty($tree, 'lang_code');
72  $tree_reflection->setAccessible(true);
73  $this->assertEquals('en', $tree_reflection->getValue($tree));
74  }
setGlobalVariable(string $name, $value)
+ Here is the call graph for this function:

◆ testTreeConstruct()

ilRepositoryTreeTest::testTreeConstruct ( )

Definition at line 46 of file ilRepositoryTreeTest.php.

46  : void
47  {
48  $tree = new ilTree(1);
49  $this->assertTrue($tree instanceof ilTree);
50  }

Field Documentation

◆ $dic

Container ilRepositoryTreeTest::$dic
protected

Definition at line 26 of file ilRepositoryTreeTest.php.

Referenced by initRepositoryTreeDependencies().


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