ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
UITestHelper Class Reference

Class UITestHelper can be helpful for test cases outside the UI Components, to inject a working factory and renderer into some classes to be unit tested. More...

+ Collaboration diagram for UITestHelper:

Public Member Functions

 init (Container $dic=null)
 
 factory ()
 
 renderer ()
 
 mainTemplate ()
 

Protected Attributes

Container $dic
 

Detailed Description

Class UITestHelper can be helpful for test cases outside the UI Components, to inject a working factory and renderer into some classes to be unit tested.

See UITestHelperTest for an example of how this can be used.

Definition at line 36 of file UITestHelper.php.

Member Function Documentation

◆ factory()

UITestHelper::factory ( )

Definition at line 60 of file UITestHelper.php.

60 : Factory
61 {
62 if (!isset($this->dic)) {
63 $this->init();
64 }
65 return $this->dic->ui()->factory();
66 }
init(Container $dic=null)
This is how the factory for UI elements looks.
Definition: Factory.php:38

References init().

+ Here is the call graph for this function:

◆ init()

UITestHelper::init ( Container  $dic = null)

Definition at line 40 of file UITestHelper.php.

40 : Container
41 {
42 if ($dic) {
43 $this->dic = $dic;
44 } else {
45 $this->dic = new Container();
46 }
47
48 $tpl_fac = new ilIndependentTemplateFactory();
49 $this->dic["tpl"] = $tpl_fac->getTemplate("tpl.main.html", false, false);
50 $this->dic["lng"] = new ilLanguageMock();
51 $data_factory = new DataFactory();
52 $this->dic["refinery"] = new RefinaryFactory($data_factory, $this->dic["lng"]);
53 (new InitUIFramework())->init($this->dic);
54 $this->dic["ui.template_factory"] = new ilIndependentTemplateFactory();
55 ;
56
57 return $this->dic;
58 }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:32
Responsible for loading the UI Framework into the dependency injection container of ILIAS.
Container $dic

References $dic, and init().

Referenced by factory(), init(), mainTemplate(), and renderer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mainTemplate()

UITestHelper::mainTemplate ( )

Definition at line 76 of file UITestHelper.php.

77 {
78 if (!isset($this->dic)) {
79 $this->init();
80 }
81 return $this->dic->ui()->mainTemplate();
82 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References init().

+ Here is the call graph for this function:

◆ renderer()

UITestHelper::renderer ( )

Definition at line 68 of file UITestHelper.php.

68 : Renderer
69 {
70 if (!isset($this->dic)) {
71 $this->init();
72 }
73 return $this->dic->ui()->renderer();
74 }
An entity that renders components to a string output.
Definition: Renderer.php:31

References init().

+ Here is the call graph for this function:

Field Documentation

◆ $dic

Container UITestHelper::$dic
protected

Definition at line 38 of file UITestHelper.php.

Referenced by init().


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