ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
UITestHelper.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21require_once(__DIR__ . '/../../../../vendor/composer/vendor/autoload.php');
22require_once(__DIR__ . '/Base.php');
23
27use ILIAS\Refinery\Factory as RefinaryFactory;
28use ILIAS\Data\Factory as DataFactory;
29
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}
mainTemplate()
trait UITestHelper
Class UITestHelper can be helpful for test cases outside the UI Components, to inject a working facto...
renderer()
factory()
init(?Container $dic=null)
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
Builds data types.
Definition: Factory.php:36
This HelpTextRetriever simply echo the purpose and the topics for debugging and development purpose.
Definition: Echoing.php:31
This is more or less a copy of the removed InitUIFramework file inside the Init component.
This is how the factory for UI elements looks.
Definition: Factory.php:38
An entity that renders components to a string output.
Definition: Renderer.php:31
$dic
Definition: ltiresult.php:33