ILIAS  release_8 Revision v8.24
UITestHelper.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
21require_once("libs/composer/vendor/autoload.php");
22
23require_once(__DIR__ . "/Base.php");
24
28use ILIAS\Refinery\Factory as RefinaryFactory;
29use ILIAS\Data\Factory as DataFactory;
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}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:32
Builds data types.
Definition: Factory.php:21
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...
init(Container $dic=null)
Container $dic
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...