ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 8 of file ilRepositoryTreeTest.php.

Member Function Documentation

◆ initRepositoryTreeDependencies()

ilRepositoryTreeTest::initRepositoryTreeDependencies ( )
protected

Definition at line 63 of file ilRepositoryTreeTest.php.

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

Referenced by setUp().

63  : void
64  {
65  $this->dic = new Container();
66  $GLOBALS['DIC'] = $this->dic;
67 
68  $this->setGlobalVariable('ilDB', $this->createMock(ilDBInterface::class));
69  $this->setGlobalVariable('ilAppEventHandler', $this->createMock(ilAppEventHandler::class));
70 
71  $logger = $this->getMockBuilder(ilLogger::class)
72  ->disableOriginalConstructor()
73  ->getMock();
74 
75  $logger_factory = $this->getMockBuilder(ilLoggerFactory::class)
76  ->disableOriginalConstructor()
77  ->onlyMethods(['getComponentLogger'])
78  ->getMock();
79  $logger_factory->method('getComponentLogger')->willReturn($logger);
80  $this->setGlobalVariable('ilLoggerFactory', $logger_factory);
81  }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
$GLOBALS["DIC"]
Definition: wac.php:31
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 52 of file ilRepositoryTreeTest.php.

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

Referenced by initRepositoryTreeDependencies(), and testInitLanguage().

52  : void
53  {
54  global $DIC;
55 
56  $GLOBALS[$name] = $value;
57  unset($DIC[$name]);
58  $DIC[$name] = static function (\ILIAS\DI\Container $c) use ($value) {
59  return $value;
60  };
61  }
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()

ilRepositoryTreeTest::setUp ( )
protected

Definition at line 12 of file ilRepositoryTreeTest.php.

References initRepositoryTreeDependencies().

12  : void
13  {
15  parent::setUp();
16  }
+ Here is the call graph for this function:

◆ testInitLanguage()

ilRepositoryTreeTest::testInitLanguage ( )

Definition at line 24 of file ilRepositoryTreeTest.php.

References setGlobalVariable().

24  : void
25  {
26  // no global user available
27  $tree = new ilTree(1);
28  $tree->initLangCode();
29  $tree_reflection = new ReflectionProperty($tree, 'lang_code');
30  $tree_reflection->setAccessible(true);
31  $this->assertEquals('en', $tree_reflection->getValue($tree));
32 
33  // user getCurrentLanguage() from session is empty
34  $tree = new ilTree(1);
35 
36  $user = $this->getMockBuilder(ilObjUser::class)
37  ->disableOriginalConstructor()
38  ->onlyMethods(['getCurrentLanguage'])
39  ->getMock();
40  $user->method('getCurrentLanguage')->willReturn('');
41  $this->setGlobalVariable('ilUser', $user);
42  $tree->initLangCode();
43  $tree_reflection = new ReflectionProperty($tree, 'lang_code');
44  $tree_reflection->setAccessible(true);
45  $this->assertEquals('en', $tree_reflection->getValue($tree));
46  }
setGlobalVariable(string $name, $value)
+ Here is the call graph for this function:

◆ testTreeConstruct()

ilRepositoryTreeTest::testTreeConstruct ( )

Definition at line 18 of file ilRepositoryTreeTest.php.

18  : void
19  {
20  $tree = new ilTree(1);
21  $this->assertTrue($tree instanceof ilTree);
22  }

Field Documentation

◆ $dic

Container ilRepositoryTreeTest::$dic
protected

Definition at line 10 of file ilRepositoryTreeTest.php.

Referenced by initRepositoryTreeDependencies().


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