ILIAS  release_8 Revision v8.23
UITestHelper.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
21 require_once("libs/composer/vendor/autoload.php");
22 
23 require_once(__DIR__ . "/Base.php");
24 
30 
37 {
38  protected Container $dic;
39 
40  public function init(Container $dic = null): 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  }
59 
60  public function factory(): Factory
61  {
62  if (!isset($this->dic)) {
63  $this->init();
64  }
65  return $this->dic->ui()->factory();
66  }
67 
68  public function renderer(): Renderer
69  {
70  if (!isset($this->dic)) {
71  $this->init();
72  }
73  return $this->dic->ui()->renderer();
74  }
75 
77  {
78  if (!isset($this->dic)) {
79  $this->init();
80  }
81  return $this->dic->ui()->mainTemplate();
82  }
83 }
An entity that renders components to a string output.
Definition: Renderer.php:30
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...
Class UITestHelper can be helpful for test cases outside the UI Components, to inject a working facto...