ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 ()
 
 getRefinery ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null)
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML ($html)
 A more radical version of normalizeHTML. More...
 

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.

127 : void
128 {
129 parent::setUp();
130 $this->tpl_factory = new TemplateFactoryMock();
131 $this->ui_factory = $this->getUIFactory(); //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 200 of file AbstractRendererTest.php.

201 {
202 $r = new \ILIAS\UI\Implementation\Component\Symbol\Glyph\GlyphNonAbstractRendererWithJS(
203 $this->ui_factory,
204 $this->tpl_factory,
205 $this->lng,
206 $this->js_binding,
207 $this->getRefinery()
208 );
209
210 $g = new \ILIAS\UI\Implementation\Component\Symbol\Glyph\Glyph(\ILIAS\UI\Component\Symbol\Glyph\Glyph::SETTINGS, "aria_label");
211
212 $g = $g->withOnLoadCode(function ($id) {
213 return null;
214 });
215
216 try {
217 $r->render($g, new NullDefaultRenderer());
218 $this->assertFalse("This should not happen...");
219 } catch (\LogicException $e) {
220 $this->assertTrue(true);
221 }
222 }
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.

References Vendor\Package\$e.

◆ test_bindJavaScript_successfull()

AbstractRendererTest::test_bindJavaScript_successfull ( )

Definition at line 176 of file AbstractRendererTest.php.

177 {
178 $r = new \ILIAS\UI\Implementation\Component\Symbol\Glyph\GlyphNonAbstractRendererWithJS(
179 $this->ui_factory,
180 $this->tpl_factory,
181 $this->lng,
182 $this->js_binding,
183 $this->getRefinery()
184 );
185
186 $g = new \ILIAS\UI\Implementation\Component\Symbol\Glyph\Glyph(\ILIAS\UI\Component\Symbol\Glyph\Glyph::SETTINGS, "aria_label");
187
188 $ids = array();
189 $g = $g->withOnLoadCode(function ($id) use (&$ids) {
190 $ids[] = $id;
191 return "ID: $id";
192 });
193 $r->render($g, new NullDefaultRenderer());
194
195 $this->assertEquals($this->js_binding->ids, $ids);
196 $this->assertEquals(array("id_1"), $ids);
197 $this->assertEquals(array("ID: id_1"), $this->js_binding->on_load_code);
198 }

◆ test_getTemplate_successfull()

AbstractRendererTest::test_getTemplate_successfull ( )

Definition at line 136 of file AbstractRendererTest.php.

137 {
138 $r = new \ILIAS\UI\Implementation\Component\Symbol\Glyph\GlyphNonAbstractRenderer(
139 $this->ui_factory,
140 $this->tpl_factory,
141 $this->lng,
142 $this->js_binding,
143 $this->getRefinery()
144 );
145 $tpl = $r->_getTemplate("tpl.glyph.html", true, false);
146
147 $expected = array( realpath(__DIR__ . "/../../../src/UI/templates/default/Symbol/tpl.glyph.html")
148 => array(true, false)
149 );
150
151 $this->assertEquals($expected, $this->tpl_factory->files);
152 }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl

References $tpl.

◆ test_getTemplate_unsuccessfull()

AbstractRendererTest::test_getTemplate_unsuccessfull ( )

Definition at line 154 of file AbstractRendererTest.php.

155 {
156 $r = new \ILIAS\UI\Implementation\Component\Counter\CounterNonAbstractRenderer(
157 $this->ui_factory,
158 $this->tpl_factory,
159 $this->lng,
160 $this->js_binding,
161 $this->getRefinery()
162 );
163
164 try {
165 $tpl = $r->_getTemplate("tpl.counter_foo.html", true, false);
166 $this->assertFalse("We should not get here");
167 } catch (\InvalidArgumentException $e) {
168 };
169
170 $expected = array( realpath(__DIR__ . "/../../src/UI/templates/default/Counter/tpl.counter_foo.html")
171 => array(true, false)
172 );
173 $this->assertEquals($expected, $this->tpl_factory->files);
174 }

References Vendor\Package\$e, and $tpl.


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