ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

References init().

60  : Factory
61  {
62  if (!isset($this->dic)) {
63  $this->init();
64  }
65  return $this->dic->ui()->factory();
66  }
init(Container $dic=null)
+ Here is the call graph for this function:

◆ init()

UITestHelper::init ( Container  $dic = null)

Definition at line 40 of file UITestHelper.php.

References $dic.

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

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  }
Container $dic
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:31
init(Container $dic=null)
Responsible for loading the UI Framework into the dependency injection container of ILIAS...
+ Here is the caller graph for this function:

◆ mainTemplate()

UITestHelper::mainTemplate ( )

Definition at line 76 of file UITestHelper.php.

References init().

77  {
78  if (!isset($this->dic)) {
79  $this->init();
80  }
81  return $this->dic->ui()->mainTemplate();
82  }
init(Container $dic=null)
+ Here is the call graph for this function:

◆ renderer()

UITestHelper::renderer ( )

Definition at line 68 of file UITestHelper.php.

References init().

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:30
init(Container $dic=null)
+ 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: