19 declare(strict_types=1);
22 require_once(
"vendor/composer/vendor/autoload.php");
43 public array $ids = array();
73 require_once(__DIR__ .
"/../Base.php");
108 public function get(?
string $block =
null):
string 120 public array $files = array();
124 $file_name = realpath(__DIR__ .
"/../../../../../" . $path);
125 $this->files[$file_name] = array($purge_unfilled_vars, $purge_unused_blocks);
127 if (!file_exists($file_name)) {
166 $this->image_path_resolver = $this->getMockBuilder(
ILIAS\
UI\
Implementation\Render\ImagePathResolver::class)
168 $this->help_text_retriever = $this->createMock(
ILIAS\
UI\HelpTextRetriever::class);
178 $this->image_path_resolver,
180 $this->help_text_retriever,
183 $r->_getTemplate(
"tpl.glyph.html",
true,
false);
185 $expected = array(realpath(__DIR__ .
"/../../../../../components/ILIAS/UI/src/templates/default/Symbol/tpl.glyph.html")
186 => array(
true,
false)
189 $this->assertEquals($expected, $this->tpl_factory->files);
199 $this->image_path_resolver,
201 $this->help_text_retriever,
205 $this->expectException(TypeError::class);
206 $r->_getTemplate(
"tpl.counter_foo.html",
true,
false);
208 $expected = array(realpath(__DIR__ .
"/../../components/ILIAS/UI/src/templates/default/Counter/tpl.counter_foo.html")
209 => array(
true,
false)
211 $this->assertEquals($expected, $this->tpl_factory->files);
221 $this->image_path_resolver,
223 $this->help_text_retriever,
227 $g =
new Glyph(C\Symbol\
Glyph\Glyph::SETTINGS,
"aria_label");
230 $g = $g->withOnLoadCode(
function (
$id) use (&$ids) {
236 $this->assertEquals($this->js_binding->ids, $ids);
237 $this->assertEquals(array(
"id_1"), $ids);
238 $this->assertEquals(array(
"ID: id_1"), $this->js_binding->on_load_code);
248 $this->image_path_resolver,
250 $this->help_text_retriever,
254 $g =
new Glyph(C\Symbol\
Glyph\Glyph::SETTINGS,
"aria_label");
256 $g = $g->withOnLoadCode(
function (
$id) {
262 $this->assertFalse(
"This should not happen...");
264 $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.
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)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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)
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
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.