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

Public Member Functions

 test_getRenderer_successfully ()
 
 test_getRenderer_caching ()
 
 getResourceRegistry ()
 
 test_invokesRegistry ()
 
 test_withAdditionalContext_clones ()
 
 test_getContexts ()
 
 test_passesContextsToComponentRendererLoader ()
 
 test_render ()
 
 test_render_async_no_js ()
 
 test_render_async_with_js ()
 
 test_render_async_with_js_twice ()
 
 test_render_async_array ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Detailed Description

Definition at line 12 of file DefaultRendererTest.php.

Member Function Documentation

◆ getResourceRegistry()

DefaultRendererTest::getResourceRegistry ( )

Definition at line 30 of file DefaultRendererTest.php.

31  {
32  $this->resource_registry = parent::getResourceRegistry();
33  return $this->resource_registry;
34  }

◆ test_getContexts()

DefaultRendererTest::test_getContexts ( )

Definition at line 54 of file DefaultRendererTest.php.

References ILIAS_UI_TestBase\getDefaultRenderer().

55  {
56  $dr = $this->getDefaultRenderer();
57  $c1 = new \ILIAS\UI\Component\Test\TestComponent("foo");
58  $c2 = new \ILIAS\UI\Component\Test\TestComponent("bar");
59  $dr2 = $dr
60  ->withAdditionalContext($c1)
61  ->withAdditionalContext($c2);
62  $this->assertEquals([], $dr->_getContexts());
63  $this->assertEquals([$c1, $c2], $dr2->_getContexts());
64  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
+ Here is the call graph for this function:

◆ test_getRenderer_caching()

DefaultRendererTest::test_getRenderer_caching ( )

Definition at line 22 of file DefaultRendererTest.php.

References ILIAS_UI_TestBase\getDefaultRenderer().

23  {
24  $dr = $this->getDefaultRenderer();
25  $r1 = $dr->_getRendererFor(new \ILIAS\UI\Implementation\Component\Glyph\Glyph("up", "up"));
26  $r2 = $dr->_getRendererFor(new \ILIAS\UI\Implementation\Component\Glyph\Glyph("up", "up"));
27  $this->assertTrue($r1 === $r2, "Instances not equal");
28  }
Class Factory.
Class BaseForm.
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
+ Here is the call graph for this function:

◆ test_getRenderer_successfully()

DefaultRendererTest::test_getRenderer_successfully ( )

Definition at line 14 of file DefaultRendererTest.php.

References $r, and ILIAS_UI_TestBase\getDefaultRenderer().

15  {
16  // There should be a renderer for Glyph...
17  $dr = $this->getDefaultRenderer();
18  $r = $dr->_getRendererFor(new \ILIAS\UI\Implementation\Component\Glyph\Glyph("up", "up"));
19  $this->assertInstanceOf(\ILIAS\UI\Implementation\Render\ComponentRenderer::class, $r);
20  }
Class Factory.
Class BaseForm.
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
$r
Definition: example_031.php:79
+ Here is the call graph for this function:

◆ test_invokesRegistry()

DefaultRendererTest::test_invokesRegistry ( )

Definition at line 36 of file DefaultRendererTest.php.

References array, and ILIAS_UI_TestBase\getDefaultRenderer().

37  {
38  $dr = $this->getDefaultRenderer();
39  $component = new \ILIAS\UI\Component\Test\TestComponent("foo");
40 
41  $dr->render($component);
42 
43  $this->assertEquals(array("test.js"), $this->resource_registry->resources);
44  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ test_passesContextsToComponentRendererLoader()

DefaultRendererTest::test_passesContextsToComponentRendererLoader ( )

Definition at line 66 of file DefaultRendererTest.php.

References $loader.

67  {
68  $loader = $this
69  ->getMockBuilder(\ILIAS\UI\Implementation\Render\Loader::class)
70  ->setMethods(["getRendererFor", "getRendererFactoryFor"])
71  ->getMock();
72 
73  $renderer = new TestDefaultRenderer($loader);
74 
75  $c1 = new \ILIAS\UI\Component\Test\TestComponent("foo");
76  $c2 = new \ILIAS\UI\Component\Test\TestComponent("bar");
77 
78  $renderer = $renderer
79  ->withAdditionalContext($c1)
80  ->withAdditionalContext($c2);
81 
82  $loader
83  ->expects($this->once())
84  ->method("getRendererFor")
85  ->with($c1, [$c1, $c2]);
86 
87  $renderer->_getRendererFor($c1);
88  }
Class Factory.
Class BaseForm.

◆ test_render()

DefaultRendererTest::test_render ( )

Definition at line 90 of file DefaultRendererTest.php.

References $html, and ILIAS_UI_TestBase\getDefaultRenderer().

91  {
92  $c1 = new \ILIAS\UI\Component\Test\TestComponent("foo");
93  $renderer = $this->getDefaultRenderer();
94  $html = $renderer->render($c1);
95  $this->assertEquals("foo", $html);
96  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_render_async_array()

DefaultRendererTest::test_render_async_array ( )

Definition at line 135 of file DefaultRendererTest.php.

References $html, ILIAS_UI_TestBase\getDefaultRenderer(), and ILIAS_UI_TestBase\getTemplateFactory().

136  {
137  $c1 = new \ILIAS\UI\Component\Test\TestComponent("foo");
138 
139  $renderer = $this->getDefaultRenderer(
140  new \ILIAS\UI\Implementation\Render\ilJavaScriptBinding($this->getTemplateFactory()->getTemplate(false, false, false))
141  );
142  $html = $renderer->renderAsync([$c1,$c1]);
143  $this->assertEquals('foofoo', $html);
144  }
Class Factory.
Class BaseForm.
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
getTemplateFactory()
Definition: Base.php:196
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_render_async_no_js()

DefaultRendererTest::test_render_async_no_js ( )

Definition at line 98 of file DefaultRendererTest.php.

References $html, ILIAS_UI_TestBase\getDefaultRenderer(), and ILIAS_UI_TestBase\getTemplateFactory().

99  {
100  $c1 = new \ILIAS\UI\Component\Test\TestComponent("foo");
101  $renderer = $this->getDefaultRenderer(
102  new \ILIAS\UI\Implementation\Render\ilJavaScriptBinding(
103  $this->getTemplateFactory()->getTemplate(false, false, false)
104  )
105  );
106  $html = $renderer->renderAsync($c1);
107  $this->assertEquals("foo", $html);
108  }
Class Factory.
Class BaseForm.
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
getTemplateFactory()
Definition: Base.php:196
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_render_async_with_js()

DefaultRendererTest::test_render_async_with_js ( )

Definition at line 110 of file DefaultRendererTest.php.

References $html, ILIAS_UI_TestBase\getDefaultRenderer(), and ILIAS_UI_TestBase\getTemplateFactory().

111  {
112  $c1 = new \ILIAS\UI\Component\Test\JSTestComponent("foo");
113  $renderer = $this->getDefaultRenderer(
114  new \ILIAS\UI\Implementation\Render\ilJavaScriptBinding($this->getTemplateFactory()->getTemplate(false, false, false))
115  );
116  $html = $renderer->renderAsync($c1);
117  $this->assertEquals('foo<script>id:foo.id content:foo</script>', $html);
118  }
Class Factory.
Class BaseForm.
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
getTemplateFactory()
Definition: Base.php:196
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_render_async_with_js_twice()

DefaultRendererTest::test_render_async_with_js_twice ( )

Definition at line 120 of file DefaultRendererTest.php.

References $html, ILIAS_UI_TestBase\getDefaultRenderer(), and ILIAS_UI_TestBase\getTemplateFactory().

121  {
122  $c1 = new \ILIAS\UI\Component\Test\TestComponent("foo");
123  $c2 = new \ILIAS\UI\Component\Test\JSTestComponent("foo");
124  $renderer = $this->getDefaultRenderer(
125  new \ILIAS\UI\Implementation\Render\ilJavaScriptBinding($this->getTemplateFactory()->getTemplate(false, false, false))
126  );
127  $html = $renderer->renderAsync($c2);
128  $this->assertEquals('foo<script>id:foo.id content:foo</script>', $html);
129  $html = $renderer->renderAsync($c1);
130  $this->assertEquals("foo", $html);
131  $html = $renderer->renderAsync($c2);
132  $this->assertEquals('foo<script>id:foo.id content:foo</script>', $html);
133  }
Class Factory.
Class BaseForm.
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
getTemplateFactory()
Definition: Base.php:196
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_withAdditionalContext_clones()

DefaultRendererTest::test_withAdditionalContext_clones ( )

Definition at line 46 of file DefaultRendererTest.php.

References ILIAS_UI_TestBase\getDefaultRenderer().

47  {
48  $dr = $this->getDefaultRenderer();
49  $component = new \ILIAS\UI\Component\Test\TestComponent("foo");
50  $dr2 = $dr->withAdditionalContext($component);
51  $this->assertNotSame($dr, $dr2);
52  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
+ Here is the call graph for this function:

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