3 declare(strict_types=1);
21 require_once(__DIR__ .
"/TestComponent.php");
22 require_once(__DIR__ .
"/../Base.php");
40 $r = $dr->_getRendererFor(
new Glyph(
"up",
"up"));
41 $this->assertInstanceOf(ComponentRenderer::class, $r);
47 $r1 = $dr->_getRendererFor(
new Glyph(
"up",
"up"));
48 $r2 = $dr->_getRendererFor(
new Glyph(
"up",
"up"));
49 $this->assertTrue($r1 === $r2,
"Instances not equal");
54 $this->resource_registry = parent::getResourceRegistry();
55 return $this->resource_registry;
63 $dr->render($component);
65 $this->assertEquals(array(
"test.js"), $this->resource_registry->resources);
72 $dr2 = $dr->withAdditionalContext($component);
73 $this->assertNotSame($dr, $dr2);
82 ->withAdditionalContext($c1)
83 ->withAdditionalContext($c2);
84 $this->assertEquals([], $dr->_getContexts());
85 $this->assertEquals([$c1, $c2], $dr2->_getContexts());
91 ->getMockBuilder(Loader::class)
92 ->onlyMethods([
"getRendererFor",
"getRendererFactoryFor"])
100 $renderer = $renderer
101 ->withAdditionalContext($c1)
102 ->withAdditionalContext($c2);
105 ->expects($this->once())
106 ->method(
"getRendererFor")
107 ->with($c1, [$c1, $c2]);
109 $renderer->_getRendererFor($c1);
116 $html = $renderer->render($c1);
117 $this->assertEquals(
"foo", $html);
128 $html = $renderer->renderAsync($c1);
129 $this->assertEquals(
"foo", $html);
138 $html = $renderer->renderAsync($c1);
139 $this->assertEquals(
'foo<script data-replace-marker="script">id:foo.id content:foo</script>', $html);
149 $html = $renderer->renderAsync($c2);
150 $this->assertEquals(
'foo<script data-replace-marker="script">id:foo.id content:foo</script>', $html);
151 $html = $renderer->renderAsync($c1);
152 $this->assertEquals(
"foo", $html);
153 $html = $renderer->renderAsync($c2);
154 $this->assertEquals(
'foo<script data-replace-marker="script">id:foo.id content:foo</script>', $html);
164 $html = $renderer->renderAsync([$c1,$c1]);
165 $this->assertEquals(
'foofoo', $html);
173 $this->component_renderer = $this->createMock(ComponentRenderer::class);
174 $component = $this->createMock(
C\Component::class);
184 return $this->
self->component_renderer;
187 protected function getJSCodeForAsyncRenderingFor(
C\
Component $component)
193 $this->component_renderer->expects($this->once())
195 ->with($component, $renderer);
197 $renderer->$render_type($component);
205 $this->component_renderer = $this->createMock(ComponentRenderer::class);
206 $component = $this->createMock(
C\Component::class);
207 $root = $this->createMock(Renderer::class);
217 return $this->
self->component_renderer;
220 protected function getJSCodeForAsyncRenderingFor(
C\
Component $component)
226 $this->component_renderer->expects($this->once())
228 ->with($component, $root);
230 $renderer->$render_type($component, $root);
243 $component = $this->createMock(
C\Component::class);
244 $root = $this->createMock(Renderer::class);
253 $root->expects($this->exactly(2))
258 $res = $renderer->render([$component, $component], $root);
259 $this->assertEquals(
"..",
$res);
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
test_render_async_array()
test_passesContextsToComponentRendererLoader()
test_component_list_uses_root_to_render()
test_passes_other_on_as_root($render_type)
render_type
Class ChatMainBarProvider .
An entity that renders components to a string output.
Wraps global ilTemplate to provide JavaScriptBinding.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
test_render_async_with_js_twice()
test_render_async_with_js()
test_render_async_no_js()
Provides common functionality for UI tests.
test_passes_self_as_root_if_no_root_exist($render_type)
render_type
test_getRenderer_caching()
test_getRenderer_successfully()
test_withAdditionalContext_clones()
__construct(Container $dic, ilPlugin $plugin)