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

Public Member Functions

 setUp ()
 
 test_getTemplate_successfull ()
 
 test_getTemplate_unsuccessfull ()
 
 test_bindJavaScript_successfull ()
 
 test_bindJavaScript_no_string ()
 
- 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 125 of file AbstractRendererTest.php.

Member Function Documentation

◆ setUp()

AbstractRendererTest::setUp ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 127 of file AbstractRendererTest.php.

128 {
129 parent::setUp();
130 $this->tpl_factory = new TemplateFactoryMock();
131 $this->ui_factory = new NoUIFactory();
132 $this->lng = new ilLanguageMock();
133 $this->js_binding = new LoggingJavaScriptBinding();
134 }

◆ test_bindJavaScript_no_string()

AbstractRendererTest::test_bindJavaScript_no_string ( )

Definition at line 182 of file AbstractRendererTest.php.

183 {
184 $r = new \ILIAS\UI\Implementation\Component\Glyph\GlyphNonAbstractRendererWithJS($this->ui_factory, $this->tpl_factory, $this->lng, $this->js_binding);
185
186 $g = new \ILIAS\UI\Implementation\Component\Glyph\Glyph(\ILIAS\UI\Component\Glyph\Glyph::SETTINGS, "aria_label");
187
188 $g = $g->withOnLoadCode(function ($id) {
189 return null;
190 });
191
192 try {
193 $r->render($g, new NullDefaultRenderer());
194 $this->assertFalse("This should not happen...");
195 } catch (\LogicException $e) {
196 $this->assertTrue(true);
197 }
198 }
$r
Definition: example_031.php:79
if(!array_key_exists('StateId', $_REQUEST)) $id
Class BaseForm.
Class Factory.

References $id, and $r.

◆ test_bindJavaScript_successfull()

AbstractRendererTest::test_bindJavaScript_successfull ( )

Definition at line 164 of file AbstractRendererTest.php.

165 {
166 $r = new \ILIAS\UI\Implementation\Component\Glyph\GlyphNonAbstractRendererWithJS($this->ui_factory, $this->tpl_factory, $this->lng, $this->js_binding);
167
168 $g = new \ILIAS\UI\Implementation\Component\Glyph\Glyph(\ILIAS\UI\Component\Glyph\Glyph::SETTINGS, "aria_label");
169
170 $ids = array();
171 $g = $g->withOnLoadCode(function ($id) use (&$ids) {
172 $ids[] = $id;
173 return "ID: $id";
174 });
175 $r->render($g, new NullDefaultRenderer());
176
177 $this->assertEquals($this->js_binding->ids, $ids);
178 $this->assertEquals(array("id_1"), $ids);
179 $this->assertEquals(array("ID: id_1"), $this->js_binding->on_load_code);
180 }

References $id, and $r.

◆ test_getTemplate_successfull()

AbstractRendererTest::test_getTemplate_successfull ( )

Definition at line 136 of file AbstractRendererTest.php.

137 {
138 $r = new \ILIAS\UI\Implementation\Component\Glyph\GlyphNonAbstractRenderer($this->ui_factory, $this->tpl_factory, $this->lng, $this->js_binding);
139 $tpl = $r->_getTemplate("tpl.glyph.html", true, false);
140
141 $expected = array( realpath(__DIR__ . "/../../../src/UI/templates/default/Glyph/tpl.glyph.html")
142 => array(true, false)
143 );
144
145 $this->assertEquals($expected, $this->tpl_factory->files);
146 }
$tpl
Definition: ilias.php:10

References $r, and $tpl.

◆ test_getTemplate_unsuccessfull()

AbstractRendererTest::test_getTemplate_unsuccessfull ( )

Definition at line 148 of file AbstractRendererTest.php.

149 {
150 $r = new \ILIAS\UI\Implementation\Component\Counter\CounterNonAbstractRenderer($this->ui_factory, $this->tpl_factory, $this->lng, $this->js_binding);
151
152 try {
153 $tpl = $r->_getTemplate("tpl.counter_foo.html", true, false);
154 $this->assertFalse("We should not get here");
155 } catch (\InvalidArgumentException $e) {
156 };
157
158 $expected = array( realpath(__DIR__ . "/../../src/UI/templates/default/Counter/tpl.counter_foo.html")
159 => array(true, false)
160 );
161 $this->assertEquals($expected, $this->tpl_factory->files);
162 }

References $r, and $tpl.


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