ILIAS  trunk Revision v11.0_alpha-1843-g9e1fad99175
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 
35 trait UITestHelper
36 {
37  protected Container $dic_with_ui;
38 
39  public function init(?Container $dic = null): Container
40  {
41  if ($dic) {
42  $this->dic_with_ui = $dic;
43  } else {
44  $this->dic_with_ui = new Container();
45  }
46 
47  $tpl_fac = new ilIndependentTemplateFactory();
48  $this->dic_with_ui["tpl"] = $tpl_fac->getTemplate("tpl.main.html", false, false);
49  $this->dic_with_ui["lng"] = new LanguageMock();
50  $data_factory = new DataFactory();
51  $this->dic_with_ui["refinery"] = new RefinaryFactory($data_factory, $this->dic_with_ui["lng"]);
52 
53  (new InitUIFramework())->init($this->dic_with_ui);
54 
55  $this->dic_with_ui["ui.template_factory"] = new ilIndependentTemplateFactory();
56  $this->dic_with_ui["help.text_retriever"] = new ILIAS\UI\Help\TextRetriever\Echoing();
57 
58  return $this->dic_with_ui;
59  }
60 
61  public function factory(): Factory
62  {
63  if (!isset($this->dic_with_ui)) {
64  $this->init();
65  }
66  return $this->dic_with_ui->ui()->factory();
67  }
68 
69  public function renderer(): Renderer
70  {
71  if (!isset($this->dic_with_ui)) {
72  $this->init();
73  }
74  return $this->dic_with_ui->ui()->renderer();
75  }
76 
78  {
79  if (!isset($this->dic_with_ui)) {
80  $this->init();
81  }
82  return $this->dic_with_ui->ui()->mainTemplate();
83  }
84 }
factory()
renderer()
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
This is more or less a copy of the removed InitUIFramework file inside the Init component.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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...
init(?Container $dic=null)
$dic
Definition: result.php:31
mainTemplate()