ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ComponentRendererFSLoaderTest Class Reference
+ Inheritance diagram for ComponentRendererFSLoaderTest:
+ Collaboration diagram for ComponentRendererFSLoaderTest:

Public Member Functions

 test_getRenderer_successfully ()
 
 test_getRenderer_uses_RendererFactory ()
 

Protected Member Functions

 getComponentRendererFSLoader ()
 

Detailed Description

Definition at line 15 of file ComponentRendererFSLoaderTest.php.

Member Function Documentation

◆ getComponentRendererFSLoader()

ComponentRendererFSLoaderTest::getComponentRendererFSLoader ( )
protected

Definition at line 17 of file ComponentRendererFSLoaderTest.php.

References ILIAS\UI\Implementation\Render\FSLoader\$default_renderer_factory, and $lng.

18  {
19  $ui_factory = $this->getMockBuilder(ILIAS\UI\Factory::class)->getMock();
20  $tpl_factory = $this->getMockBuilder(ILIAS\UI\Implementation\Render\TemplateFactory::class)->getMock();
21  $lng = $this->getMockBuilder(\ilLanguage::class)->disableOriginalConstructor()->getMock();
22  $js_binding = $this->getMockBuilder(ILIAS\UI\Implementation\Render\JavaScriptBinding::class)->getMock();
23  $default_renderer_factory = new \ILIAS\UI\Implementation\Render\DefaultRendererFactory($ui_factory, $tpl_factory, $lng, $js_binding);
24  return new ComponentRendererFSLoaderTesting($default_renderer_factory);
25  }
Class Factory.
Class BaseForm.
global $lng
Definition: privfeed.php:17

◆ test_getRenderer_successfully()

ComponentRendererFSLoaderTest::test_getRenderer_successfully ( )

Definition at line 27 of file ComponentRendererFSLoaderTest.php.

References $r.

28  {
29  // There should be a renderer for Glyph...
30  $f = $this->getComponentRendererFSLoader();
31  $r = $f->getRendererFor(new \ILIAS\UI\Implementation\Component\Glyph\Glyph("up", "up"), []);
32  $this->assertInstanceOf(\ILIAS\UI\Implementation\Render\ComponentRenderer::class, $r);
33  }
Class Factory.
Class BaseForm.
$r
Definition: example_031.php:79

◆ test_getRenderer_uses_RendererFactory()

ComponentRendererFSLoaderTest::test_getRenderer_uses_RendererFactory ( )

Definition at line 35 of file ComponentRendererFSLoaderTest.php.

References $factory, and $loader.

36  {
37  $loader = $this->getMockBuilder(ILIAS\UI\Implementation\Render\FSLoader::class)
38  ->setMethods(["getRendererFactoryFor", "getContextNames"])
39  ->disableOriginalConstructor()
40  ->getMock();
41  $factory = $this->getMockBuilder(ILIAS\UI\Implementation\RendererFactory::class)
42  ->setMethods(["getRendererInContext"])
43  ->getMock();
44 
45  $rendered_component = $this->createMock(ILIAS\UI\Component\Component::class);
46 
47  $component1 = $this->createMock(ILIAS\UI\Component\Component::class);
48  $component2 = $this->createMock(ILIAS\UI\Component\Component::class);
49  $component_name1 = "COMPONENT 1";
50  $component_name2 = "COMPONENT 2";
51 
52  $loader
53  ->expects($this->once())
54  ->method("getContextNames")
55  ->with([$component1, $component2])
56  ->willReturn([$component_name1, $component_name2]);
57 
58  $loader
59  ->expects($this->once())
60  ->method("getRendererFactoryFor")
61  ->with($rendered_component)
62  ->willReturn($factory);
63 
64  $renderer = "RENDERER";
65  $factory
66  ->expects($this->once())
67  ->method("getRendererInContext")
68  ->with($rendered_component, [$component_name1, $component_name2])
69  ->willReturn($renderer);
70 
71  $renderer2 = $loader->getRendererFor($rendered_component, [$component1, $component2]);
72  $this->assertEquals($renderer, $renderer2);
73  }
Class Factory.
Class BaseForm.
$factory
Definition: metadata.php:47

The documentation for this class was generated from the following file: