ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ComponentRendererFSLoaderTest Class Reference
+ Inheritance diagram for ComponentRendererFSLoaderTest:
+ Collaboration diagram for ComponentRendererFSLoaderTest:

Public Member Functions

 test_getRenderer_successfully ()
 
 test_getRenderer_successfully_extra ()
 
 test_getRenderer_uses_RendererFactory ()
 

Protected Member Functions

 getComponentRendererFSLoader ()
 

Detailed Description

Definition at line 18 of file ComponentRendererFSLoaderTest.php.

Member Function Documentation

◆ getComponentRendererFSLoader()

ComponentRendererFSLoaderTest::getComponentRendererFSLoader ( )
protected

Definition at line 20 of file ComponentRendererFSLoaderTest.php.

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

21  {
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()
28  ->getMock();
29  $image_path_resolver = $this->getMockBuilder(ILIAS\UI\Implementation\Render\ImagePathResolver::class)
30  ->getMock();
31 
32  $default_renderer_factory = new I\Render\DefaultRendererFactory(
33  $ui_factory,
34  $tpl_factory,
35  $lng,
36  $js_binding,
37  $refinery_mock,
38  $image_path_resolver
39  );
40  $this->glyph_renderer = $this->createMock(I\Render\RendererFactory::class);
41  $this->field_renderer = $this->createMock(I\Render\RendererFactory::class);
42  return new ComponentRendererFSLoaderTesting($default_renderer_factory, $this->glyph_renderer, $this->field_renderer);
43  }
Class Factory.
Class ChatMainBarProvider .
$lng

◆ test_getRenderer_successfully()

ComponentRendererFSLoaderTest::test_getRenderer_successfully ( )

Definition at line 45 of file ComponentRendererFSLoaderTest.php.

References Vendor\Package\$f.

46  {
47  // There should be a renderer for Glyph...
49  $component = new I\Component\Button\Standard("", "");
50  $r = $f->getRendererFor($component, []);
51  $this->assertInstanceOf(I\Render\ComponentRenderer::class, $r);
52  }

◆ test_getRenderer_successfully_extra()

ComponentRendererFSLoaderTest::test_getRenderer_successfully_extra ( )

Definition at line 54 of file ComponentRendererFSLoaderTest.php.

References $context, and Vendor\Package\$f.

55  {
56  // There should be a renderer for Glyph...
58  $component = new I\Component\Symbol\Glyph\Glyph("up", "up");
59  $context = $this->createMock(\ILIAS\UI\Component\Component::class);
60  $renderer = $this->createMock(I\Render\ComponentRenderer::class);
61 
62  $context_name = "foo";
63  $context
64  ->expects($this->once())
65  ->method("getCanonicalName")
66  ->willReturn($context_name);
67 
68  $this->glyph_renderer
69  ->expects($this->once())
70  ->method("getRendererInContext")
71  ->with($component, [$context_name])
72  ->willReturn($renderer);
73 
74  $r = $f->getRendererFor($component, [$context]);
75 
76  $this->assertEquals($renderer, $r);
77  }
$context
Definition: webdav.php:26
Class Factory.
Class ChatMainBarProvider .

◆ test_getRenderer_uses_RendererFactory()

ComponentRendererFSLoaderTest::test_getRenderer_uses_RendererFactory ( )

Definition at line 79 of file ComponentRendererFSLoaderTest.php.

References $factory.

80  {
81  $loader = $this->getMockBuilder(ILIAS\UI\Implementation\Render\FSLoader::class)
82  ->setMethods(["getRendererFactoryFor", "getContextNames"])
83  ->disableOriginalConstructor()
84  ->getMock();
85  $factory = $this->getMockBuilder(ILIAS\UI\Implementation\RendererFactory::class)
86  ->setMethods(["getRendererInContext"])
87  ->getMock();
88 
89  $rendered_component = $this->createMock(ILIAS\UI\Component\Component::class);
90 
91  $component1 = $this->createMock(ILIAS\UI\Component\Component::class);
92  $component2 = $this->createMock(ILIAS\UI\Component\Component::class);
93  $component_name1 = "COMPONENT 1";
94  $component_name2 = "COMPONENT 2";
95 
96  $loader
97  ->expects($this->once())
98  ->method("getContextNames")
99  ->with([$component1, $component2])
100  ->willReturn([$component_name1, $component_name2]);
101 
102  $loader
103  ->expects($this->once())
104  ->method("getRendererFactoryFor")
105  ->with($rendered_component)
106  ->willReturn($factory);
107 
108  $renderer = "RENDERER";
109  $factory
110  ->expects($this->once())
111  ->method("getRendererInContext")
112  ->with($rendered_component, [$component_name1, $component_name2])
113  ->willReturn($renderer);
114 
115  $renderer2 = $loader->getRendererFor($rendered_component, [$component1, $component2]);
116  $this->assertEquals($renderer, $renderer2);
117  }
Class Factory.
Class ChatMainBarProvider .
$factory
Definition: metadata.php:58

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