19 declare(strict_types=1);
22 require_once(
"vendor/composer/vendor/autoload.php");
43 public array $ids = array();
89 require_once(__DIR__ .
"/../Base.php");
124 public function get(
string $block = null):
string 136 public array $files = array();
140 $file_name = realpath(__DIR__ .
"/../../../../../" . $path);
141 $this->files[$file_name] = array($purge_unfilled_vars, $purge_unused_blocks);
143 if (!file_exists($file_name)) {
182 $this->image_path_resolver = $this->getMockBuilder(
ILIAS\
UI\
Implementation\Render\ImagePathResolver::class)
184 $this->help_text_retriever = $this->createMock(
ILIAS\
UI\HelpTextRetriever::class);
194 $this->image_path_resolver,
196 $this->help_text_retriever,
199 $r->_getTemplate(
"tpl.glyph.html",
true,
false);
201 $expected = array(realpath(__DIR__ .
"/../../../../../components/ILIAS/UI/src/templates/default/Symbol/tpl.glyph.html")
202 => array(
true,
false)
205 $this->assertEquals($expected, $this->tpl_factory->files);
215 $this->image_path_resolver,
217 $this->help_text_retriever,
221 $this->expectException(TypeError::class);
222 $r->_getTemplate(
"tpl.counter_foo.html",
true,
false);
224 $expected = array(realpath(__DIR__ .
"/../../components/ILIAS/UI/src/templates/default/Counter/tpl.counter_foo.html")
225 => array(
true,
false)
227 $this->assertEquals($expected, $this->tpl_factory->files);
237 $this->image_path_resolver,
239 $this->help_text_retriever,
243 $g =
new Glyph(C\Symbol\
Glyph\Glyph::SETTINGS,
"aria_label");
246 $g = $g->withOnLoadCode(
function (
$id) use (&$ids) {
252 $this->assertEquals($this->js_binding->ids, $ids);
253 $this->assertEquals(array(
"id_1"), $ids);
254 $this->assertEquals(array(
"ID: id_1"), $this->js_binding->on_load_code);
264 $this->image_path_resolver,
266 $this->help_text_retriever,
270 $g =
new Glyph(C\Symbol\
Glyph\Glyph::SETTINGS,
"aria_label");
272 $g = $g->withOnLoadCode(
function (
$id) {
278 $this->assertFalse(
"This should not happen...");
280 $this->assertTrue(
true);
LoggingJavaScriptBinding $js_binding
TemplateFactoryMock $tpl_factory
renderAsync($component, ?Renderer $root=null)
Same as render, except that this version also returns any javascript code bound to the on load event...
touchBlock(string $name)
Touch a block without working further on it.
Interface Observer Contains several chained tasks and infos about them.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
render($component, ?Renderer $root=null)
Render given component.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
render(Component $component, Renderer $default_renderer)
render(Component $component, Renderer $default_renderer)
setVariable(string $name, $value)
Set a variable in the current block.
_getTemplate(string $a, bool $b, bool $c)
render(Component $component, Renderer $default_renderer)
addOnLoadCode(string $code)
Add some javascript to be executed on_load of the rendered page.
getTemplate(string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template of component this renderer is made for.
ILIAS UI HelpTextRetriever $help_text_retriever
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getTemplate(string $path, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template instance.
testGetTemplateSuccessfull()
testGetTemplateUnsuccessfull()
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
setCurrentBlock(string $name)
Set the block to work on.
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
getUIFactory()
Get a UI factory.
_getTemplate(string $a, bool $b, bool $c)
parseCurrentBlock()
Parse the block that is currently worked on.
testBindJavaScriptSuccessfull()
Interface for a factory that provides templates.
testBindJavaScriptNoString()
Base class for all component renderers.
bindJavaScript(JavaScriptBindable $component)
Bind the component to JavaScript.