ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilInitialisationTest Class Reference

TestCase for the ilContext @group needsInstalledILIAS. More...

+ Inheritance diagram for ilInitialisationTest:
+ Collaboration diagram for ilInitialisationTest:

Public Member Functions

 test_DIC ($global_name, $class_name)
 @dataProvider globalsProvider More...
 
 test_DIC_getters ($class_name, $getter)
 @dataProvider getterProvider More...
 
 globalsProvider ()
 
 getterProvider ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $backupGlobals = false
 

Detailed Description

TestCase for the ilContext @group needsInstalledILIAS.

Author
Richard Klees richa.nosp@m.rd.k.nosp@m.lees@.nosp@m.conc.nosp@m.epts-.nosp@m.and-.nosp@m.train.nosp@m.ing..nosp@m.de

Definition at line 11 of file ilInitialisationTest.php.

Member Function Documentation

◆ getterProvider()

ilInitialisationTest::getterProvider ( )

Definition at line 55 of file ilInitialisationTest.php.

56 {
57 return array( array("ilDBInterface", function ($DIC) {
58 return $DIC->database();
59 })
60 , array("ilCtrl", function ($DIC) {
61 return $DIC->ctrl();
62 })
63 , array("ilObjUser", function ($DIC) {
64 return $DIC->user();
65 })
66 , array("ilRbacSystem", function ($DIC) {
67 return $DIC->rbac()->system();
68 })
69 , array("ilRbacAdmin", function ($DIC) {
70 return $DIC->rbac()->admin();
71 })
72 , array("ilRbacReview", function ($DIC) {
73 return $DIC->rbac()->review();
74 })
75 , array("ilAccess", function ($DIC) {
76 return $DIC->access();
77 })
78 , array("ilTree", function ($DIC) {
79 return $DIC->repositoryTree();
80 })
81 , array("ilLanguage", function ($DIC) {
82 return $DIC->language();
83 })
84 // TODO: Can't test these until context for unit tests does not have HTML.
85 //, array("ilTemplate", function ($DIC) { return $DIC->ui()->mainTemplate(); })
86 //, array("ilToolbarGUI", function ($DIC) { return $DIC->toolbar(); })
87 //, array("ilTabsGUI", function ($DIC) { return $DIC->tabs(); })
88 //, array("ILIAS\\UI\\Factory", function ($DIC) { return $DIC->ui()->factory();})
89 //, array("ILIAS\\UI\\Renderer", function ($DIC) { return $DIC->ui()->renderer();})
90 , array("ilLogger", function ($DIC) {
91 return $DIC->logger()->root();
92 })
93 , array("ilLogger", function ($DIC) {
94 return $DIC->logger()->grp();
95 })
96 , array("ilLogger", function ($DIC) {
97 return $DIC->logger()->crs();
98 })
99 , array("ilLogger", function ($DIC) {
100 return $DIC->logger()->tree();
101 })
102 );
103 }
$DIC
Definition: xapitoken.php:46

References $DIC.

◆ globalsProvider()

ilInitialisationTest::globalsProvider ( )

Definition at line 44 of file ilInitialisationTest.php.

45 {
46 // Add combinations of globals and their classes here...
47 return array( array("ilIliasIniFile", "ilIniFile")
48 , array("ilCtrl", "ilCtrl")
49 , array("tree", "ilTree")
50 , array("ilLog", "ilLogger")
51 , array("ilDB", "ilDBInterface")
52 );
53 }

◆ setUp()

ilInitialisationTest::setUp ( )
protected

Definition at line 15 of file ilInitialisationTest.php.

15 : void
16 {
17 include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
18 ilUnitUtil::performInitialisation();
19 }

◆ test_DIC()

ilInitialisationTest::test_DIC (   $global_name,
  $class_name 
)

@dataProvider globalsProvider

Definition at line 24 of file ilInitialisationTest.php.

25 {
26 global $DIC;
27
28 $this->assertInstanceOf($class_name, $GLOBALS[$global_name]);
29 $this->assertInstanceOf($class_name, $DIC[$global_name]);
30 $this->assertSame($GLOBALS[$global_name], $DIC[$global_name]);
31 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64

References $DIC, and $GLOBALS.

◆ test_DIC_getters()

ilInitialisationTest::test_DIC_getters (   $class_name,
  $getter 
)

@dataProvider getterProvider

Definition at line 36 of file ilInitialisationTest.php.

37 {
38 global $DIC;
39
40 $service = $getter($DIC);
41 $this->assertInstanceOf($class_name, $service);
42 }
$service
Definition: result.php:17

References $DIC, and $service.

Field Documentation

◆ $backupGlobals

ilInitialisationTest::$backupGlobals = false
protected

Definition at line 13 of file ilInitialisationTest.php.


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