19declare(strict_types=1);
22 require_once(
"vendor/composer/vendor/autoload.php");
43 public array
$ids = array();
67 return $this->getTemplate(
$a,
$b,
$c);
73 require_once(__DIR__ .
"/../Base.php");
80 use PHPUnit\Framework\MockObject\MockObject;
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)) {
128 throw new InvalidArgumentException();
163 $this->ui_factory = $this->getUIFactory();
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,
181 $this->getUploadLimitResolver()
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,
202 $this->getUploadLimitResolver()
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,
224 $this->getUploadLimitResolver()
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,
251 $this->getUploadLimitResolver()
254 $g =
new Glyph(
C\Symbol\
Glyph\Glyph::SETTINGS,
"aria_label");
256 $g = $g->withOnLoadCode(
function (
$id) {
262 $this->assertFalse(
"This should not happen...");
263 }
catch (LogicException
$e) {
264 $this->assertTrue(
true);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
testBindJavaScriptNoString()
testGetTemplateSuccessfull()
LoggingJavaScriptBinding $js_binding
ILIAS UI HelpTextRetriever $help_text_retriever
testGetTemplateUnsuccessfull()
testBindJavaScriptSuccessfull()
TemplateFactoryMock $tpl_factory
render(Component $component, Renderer $default_renderer)
_getTemplate(string $a, bool $b, bool $c)
render(Component $component, Renderer $default_renderer)
_getTemplate(string $a, bool $b, bool $c)
render(Component $component, Renderer $default_renderer)
Base class for all component renderers.
bindJavaScript(JavaScriptBindable $component)
Bind the component to JavaScript.
getTemplate(string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template of component this renderer is made for.
Provides common functionality for UI tests.
renderAsync($component, ?Renderer $root=null)
Same as render, except that this version also returns any javascript code bound to the on load event,...
render($component, ?Renderer $root=null)
Render given component.
parseCurrentBlock()
Parse the block that is currently worked on.
touchBlock(string $name)
Touch a block without working further on it.
setCurrentBlock(string $name)
Set the block to work on.
setVariable(string $name, $value)
Set a variable in the current block.
addOnLoadCode(string $code)
getTemplate(string $path, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template instance.
A component is the most general form of an entity in the UI.
This describes a facility that the UI framework can use to retrieve some help text.
Some Components need to resolve pathes to image-files.
Interface for a factory that provides templates.
Interface to templating as it is used in the UI framework.
An entity that renders components to a string output.
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples