5require_once(__DIR__ . 
"/TestComponent.php");
 
    7use \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();
 
   25        $default_renderer_factory = 
new I\Render\DefaultRendererFactory($ui_factory, $tpl_factory, 
$lng, $js_binding);
 
   26        $this->glyph_renderer = $this->createMock(
I\Render\RendererFactory::class);
 
   34        $component = 
new I\Component\Button\Standard(
"", 
"");
 
   35        $r = 
$f->getRendererFor($component, []);
 
   36        $this->assertInstanceOf(
I\Render\ComponentRenderer::class, 
$r);
 
   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);
 
   76        $component1 = $this->createMock(
ILIAS\
UI\Component\Component::class);
 
   77        $component2 = $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);
 
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.
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.