5require_once(__DIR__ .
"/TestComponent.php");
7use \ILIAS\UI\Implementation as I;
8use PHPUnit\Framework\TestCase;
14 return $this->instantiateRendererFor($class);
22 $ui_factory = $this->getMockBuilder(
ILIAS\
UI\Factory::class)->getMock();
23 $tpl_factory = $this->getMockBuilder(I\Render\TemplateFactory::class)->getMock();
24 $lng = $this->getMockBuilder(\ilLanguage::class)->disableOriginalConstructor()->getMock();
25 $js_binding = $this->getMockBuilder(I\Render\JavaScriptBinding::class)->getMock();
26 $refinery_mock = $this->getMockBuilder(\
ILIAS\Refinery\Factory::class)
27 ->disableOriginalConstructor()
30 $default_renderer_factory =
new I\Render\DefaultRendererFactory(
37 $this->glyph_renderer = $this->createMock(I\Render\RendererFactory::class);
38 $this->field_renderer = $this->createMock(I\Render\RendererFactory::class);
46 $component =
new I\Component\Button\Standard(
"",
"");
47 $r =
$f->getRendererFor($component, []);
48 $this->assertInstanceOf(I\Render\ComponentRenderer::class, $r);
55 $component =
new I\Component\Symbol\Glyph\Glyph(
"up",
"up");
57 $renderer = $this->createMock(I\Render\ComponentRenderer::class);
59 $context_name =
"foo";
61 ->expects($this->once())
62 ->method(
"getCanonicalName")
63 ->willReturn($context_name);
66 ->expects($this->once())
67 ->method(
"getRendererInContext")
68 ->with($component, [$context_name])
69 ->willReturn($renderer);
71 $r =
$f->getRendererFor($component, [
$context]);
73 $this->assertEquals($renderer, $r);
78 $loader = $this->getMockBuilder(
ILIAS\
UI\Implementation\Render\FSLoader::class)
79 ->setMethods([
"getRendererFactoryFor",
"getContextNames"])
80 ->disableOriginalConstructor()
82 $factory = $this->getMockBuilder(
ILIAS\
UI\Implementation\RendererFactory::class)
83 ->setMethods([
"getRendererInContext"])
86 $rendered_component = $this->createMock(
ILIAS\
UI\Component\Component::class);
88 $component1 = $this->createMock(
ILIAS\
UI\Component\Component::class);
89 $component2 = $this->createMock(
ILIAS\
UI\Component\Component::class);
90 $component_name1 =
"COMPONENT 1";
91 $component_name2 =
"COMPONENT 2";
94 ->expects($this->once())
95 ->method(
"getContextNames")
96 ->with([$component1, $component2])
97 ->willReturn([$component_name1, $component_name2]);
100 ->expects($this->once())
101 ->method(
"getRendererFactoryFor")
102 ->with($rendered_component)
105 $renderer =
"RENDERER";
107 ->expects($this->once())
108 ->method(
"getRendererInContext")
109 ->with($rendered_component, [$component_name1, $component_name2])
110 ->willReturn($renderer);
112 $renderer2 = $loader->getRendererFor($rendered_component, [$component1, $component2]);
113 $this->assertEquals($renderer, $renderer2);
An exception for terminatinating execution or to throw for unit testing.
test_getRenderer_successfully()
getComponentRendererFSLoader()
test_getRenderer_successfully_extra()
test_getRenderer_uses_RendererFactory()
_instantiateRendererFor($class)
Loads renderers for components from the file system.
Class ChatMainBarProvider \MainMenu\Provider.