5 require_once(__DIR__ .
"/TestComponent.php");
7 use \ILIAS\UI\Implementation as
I;
13 return $this->instantiateRendererFor($class);
21 $ui_factory = $this->getMockBuilder(
ILIAS\
UI\Factory::class)->getMock();
22 $tpl_factory = $this->getMockBuilder(
I\Render\TemplateFactory::class)->getMock();
23 $lng = $this->getMockBuilder(\ilLanguage::class)->disableOriginalConstructor()->getMock();
24 $js_binding = $this->getMockBuilder(
I\Render\JavaScriptBinding::class)->getMock();
26 $this->glyph_renderer = $this->createMock(
I\Render\RendererFactory::class);
33 $f = $this->getComponentRendererFSLoader();
34 $component =
new I\Component\Button\Standard(
"",
"");
35 $r =
$f->getRendererFor($component, []);
36 $this->assertInstanceOf(
I\Render\ComponentRenderer::class,
$r);
42 $f = $this->getComponentRendererFSLoader();
43 $component =
new I\Component\Glyph\Glyph(
"up",
"up");
45 $renderer = $this->createMock(
I\Render\ComponentRenderer::class);
47 $context_name =
"foo";
49 ->expects($this->
once())
50 ->method(
"getCanonicalName")
51 ->willReturn($context_name);
54 ->expects($this->
once())
55 ->method(
"getRendererInContext")
56 ->with($component, [$context_name])
57 ->willReturn($renderer);
61 $this->assertEquals($renderer,
$r);
66 $loader = $this->getMockBuilder(
ILIAS\
UI\Implementation\Render\FSLoader::class)
67 ->setMethods([
"getRendererFactoryFor",
"getContextNames"])
68 ->disableOriginalConstructor()
70 $factory = $this->getMockBuilder(
ILIAS\
UI\Implementation\RendererFactory::class)
71 ->setMethods([
"getRendererInContext"])
74 $rendered_component = $this->createMock(
ILIAS\
UI\
Component\Component::class);
78 $component_name1 =
"COMPONENT 1";
79 $component_name2 =
"COMPONENT 2";
82 ->expects($this->
once())
83 ->method(
"getContextNames")
84 ->with([$component1, $component2])
85 ->willReturn([$component_name1, $component_name2]);
88 ->expects($this->
once())
89 ->method(
"getRendererFactoryFor")
90 ->with($rendered_component)
93 $renderer =
"RENDERER";
95 ->expects($this->
once())
96 ->method(
"getRendererInContext")
97 ->with($rendered_component, [$component_name1, $component_name2])
98 ->willReturn($renderer);
100 $renderer2 = $loader->getRendererFor($rendered_component, [$component1, $component2]);
101 $this->assertEquals($renderer, $renderer2);
test_getRenderer_successfully_extra()
Loads renderers for components from the file system.
getComponentRendererFSLoader()
test_getRenderer_uses_RendererFactory()
test_getRenderer_successfully()
$default_renderer_factory
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
_instantiateRendererFor($class)