19 declare(strict_types=1);
21 require_once(__DIR__ .
"/TestComponent.php");
44 $ui_factory = $this->getMockBuilder(
ILIAS\
UI\
Implementation\FactoryInternal::class)->disableOriginalConstructor()->getMock();
45 $tpl_factory = $this->getMockBuilder(
I\Render\TemplateFactory::class)->getMock();
46 $lng = $this->getMockBuilder(
ILIAS\Language\Language::class)->disableOriginalConstructor()->getMock();
47 $js_binding = $this->getMockBuilder(
I\Render\JavaScriptBinding::class)->getMock();
50 $data_factory = $this->getMockBuilder(
ILIAS\
Data\Factory::class)->getMock();
51 $help_text_retriever = $this->createMock(
ILIAS\
UI\HelpTextRetriever::class);
54 $default_renderer_factory =
new I\Render\DefaultRendererFactory(
62 $upload_limit_resolver,
64 $this->glyph_renderer = $this->createMock(
I\Render\RendererFactory::class);
65 $this->icon_renderer = $this->createMock(
I\Render\RendererFactory::class);
66 $messagebox_renderer = $this->createMock(
I\Render\RendererFactory::class);
67 $form_renderer = $this->createMock(
I\Render\RendererFactory::class);
69 $field_renderer = $this->createMock(
I\Render\RendererFactory::class);
71 $default_renderer_factory,
72 $this->glyph_renderer,
84 $component =
new I\Component\Button\Standard(
"",
"");
85 $r =
$f->getRendererFor($component, []);
86 $this->assertInstanceOf(
I\Render\ComponentRenderer::class,
$r);
93 $component =
new I\Component\Symbol\Glyph\Glyph(
"up",
"up");
94 $context = $this->createMock(Component::class);
95 $renderer = $this->createMock(
I\Render\ComponentRenderer::class);
97 $context_name =
"foo";
99 ->expects($this->once())
100 ->method(
"getCanonicalName")
101 ->willReturn($context_name);
103 $this->glyph_renderer
104 ->expects($this->once())
105 ->method(
"getRendererInContext")
106 ->with($component, [$context_name])
117 ->onlyMethods([
"getRendererFactoryFor",
"getContextNames"])
118 ->disableOriginalConstructor()
123 $rendered_component = $this->createMock(
ILIAS\
UI\
Component\Component::class);
127 $component_name1 =
"COMPONENT 1";
128 $component_name2 =
"COMPONENT 2";
131 ->expects($this->once())
132 ->method(
"getContextNames")
133 ->with([$component1, $component2])
134 ->willReturn([$component_name1, $component_name2]);
137 ->expects($this->once())
138 ->method(
"getRendererFactoryFor")
139 ->with($rendered_component)
140 ->willReturn($factory);
142 $renderer = $this->createMock(ComponentRenderer::class);
144 ->expects($this->once())
145 ->method(
"getRendererInContext")
146 ->with($rendered_component, [$component_name1, $component_name2])
149 $renderer2 = $loader->getRendererFor($rendered_component, [$component1, $component2]);
150 $this->assertEquals(
$renderer, $renderer2);
Loads renderers for components from the file system.
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...
getComponentRendererFSLoader()
testGetRendererUsesRendererFactory()
testGetRendererSuccessfully()
testGetRendererSuccessfullyExtra()