ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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 35 of file UITestHelper.php.

Member Function Documentation

◆ factory()

UITestHelper::factory ( )

Definition at line 59 of file UITestHelper.php.

References init().

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

◆ init()

UITestHelper::init ( Container  $dic = null)

Definition at line 39 of file UITestHelper.php.

References $dic.

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

39  : Container
40  {
41  if ($dic) {
42  $this->dic = $dic;
43  } else {
44  $this->dic = new Container();
45  }
46 
47  $tpl_fac = new ilIndependentTemplateFactory();
48  $this->dic["tpl"] = $tpl_fac->getTemplate("tpl.main.html", false, false);
49  $this->dic["lng"] = new LanguageMock();
50  $data_factory = new DataFactory();
51  $this->dic["refinery"] = new RefinaryFactory($data_factory, $this->dic["lng"]);
52  (new InitUIFramework())->init($this->dic);
53  $this->dic["ui.template_factory"] = new ilIndependentTemplateFactory();
54  $this->dic["help.text_retriever"] = new ILIAS\UI\Help\TextRetriever\Echoing();
55 
56  return $this->dic;
57  }
Container $dic
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
init(Container $dic=null)
Responsible for loading the UI Framework into the dependency injection container of ILIAS...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ mainTemplate()

UITestHelper::mainTemplate ( )

Definition at line 75 of file UITestHelper.php.

References init().

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

◆ renderer()

UITestHelper::renderer ( )

Definition at line 67 of file UITestHelper.php.

References init().

67  : Renderer
68  {
69  if (!isset($this->dic)) {
70  $this->init();
71  }
72  return $this->dic->ui()->renderer();
73  }
init(Container $dic=null)
+ Here is the call graph for this function:

Field Documentation

◆ $dic

Container UITestHelper::$dic
protected

Definition at line 37 of file UITestHelper.php.

Referenced by init().


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