ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
UITestHelper.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 require_once(__DIR__ . '/../../../../vendor/composer/vendor/autoload.php');
22 require_once(__DIR__ . '/Base.php');
23 
29 
36 {
37  protected Container $dic;
38 
39  public function init(Container $dic = null): 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  }
58 
59  public function factory(): Factory
60  {
61  if (!isset($this->dic)) {
62  $this->init();
63  }
64  return $this->dic->ui()->factory();
65  }
66 
67  public function renderer(): Renderer
68  {
69  if (!isset($this->dic)) {
70  $this->init();
71  }
72  return $this->dic->ui()->renderer();
73  }
74 
76  {
77  if (!isset($this->dic)) {
78  $this->init();
79  }
80  return $this->dic->ui()->mainTemplate();
81  }
82 }
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 is how the factory for UI elements looks.
Definition: Factory.php:37
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class UITestHelper can be helpful for test cases outside the UI Components, to inject a working facto...