ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 ()
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Detailed Description

Definition at line 86 of file AbstractRendererTest.php.

Member Function Documentation

◆ setUp()

AbstractRendererTest::setUp ( )

Definition at line 87 of file AbstractRendererTest.php.

87  {
88  parent::setUp();
89  $this->tpl_factory = new TemplateFactoryMock();
90  $this->ui_factory = new NoUIFactory();
91  $this->lng = new ilLanguageMock();
92  $this->js_binding = new LoggingJavaScriptBinding();
93  }

◆ test_bindJavaScript_no_string()

AbstractRendererTest::test_bindJavaScript_no_string ( )

Definition at line 139 of file AbstractRendererTest.php.

References $r.

139  {
140  $r = new \ILIAS\UI\Implementation\Component\Glyph\GlyphNonAbstractRendererWithJS($this->ui_factory, $this->tpl_factory, $this->lng, $this->js_binding);
141 
142  $g = new \ILIAS\UI\Implementation\Component\Glyph\Glyph(\ILIAS\UI\Component\Glyph\Glyph::SETTINGS, "aria_label");
143 
144  $g = $g->withOnLoadCode(function($id) {
145  return null;
146  });
147 
148  try {
149  $r->render($g, new NullDefaultRenderer());
150  $this->assertFalse("This should not happen...");
151  }
152  catch (\LogicException $e) {
153  $this->assertTrue(true);
154  }
155  }
Interface Card .
$r
Definition: example_031.php:79

◆ test_bindJavaScript_successfull()

AbstractRendererTest::test_bindJavaScript_successfull ( )

Definition at line 122 of file AbstractRendererTest.php.

References $r, and array.

122  {
123  $r = new \ILIAS\UI\Implementation\Component\Glyph\GlyphNonAbstractRendererWithJS($this->ui_factory, $this->tpl_factory, $this->lng, $this->js_binding);
124 
125  $g = new \ILIAS\UI\Implementation\Component\Glyph\Glyph(\ILIAS\UI\Component\Glyph\Glyph::SETTINGS, "aria_label");
126 
127  $ids = array();
128  $g = $g->withOnLoadCode(function($id) use (&$ids) {
129  $ids[] = $id;
130  return "ID: $id";
131  });
132  $r->render($g, new NullDefaultRenderer());
133 
134  $this->assertEquals($this->js_binding->ids, $ids);
135  $this->assertEquals(array("id_1"), $ids);
136  $this->assertEquals(array("ID: id_1"), $this->js_binding->on_load_code);
137  }
Interface Card .
$r
Definition: example_031.php:79
Create styles array
The data for the language used.

◆ test_getTemplate_successfull()

AbstractRendererTest::test_getTemplate_successfull ( )

Definition at line 95 of file AbstractRendererTest.php.

References $r, $tpl, and array.

95  {
96  $r = new \ILIAS\UI\Implementation\Component\Glyph\GlyphNonAbstractRenderer($this->ui_factory, $this->tpl_factory, $this->lng, $this->js_binding);
97  $tpl = $r->_getTemplate("tpl.glyph.html", true, false);
98 
99  $expected = array
100  ( realpath(__DIR__."/../../../src/UI/templates/default/Glyph/tpl.glyph.html")
101  => array(true, false)
102  );
103 
104  $this->assertEquals($expected, $this->tpl_factory->files);
105  }
global $tpl
Definition: ilias.php:8
$r
Definition: example_031.php:79
Create styles array
The data for the language used.

◆ test_getTemplate_unsuccessfull()

AbstractRendererTest::test_getTemplate_unsuccessfull ( )

Definition at line 107 of file AbstractRendererTest.php.

References $r, $tpl, and array.

107  {
108  $r = new \ILIAS\UI\Implementation\Component\Counter\CounterNonAbstractRenderer($this->ui_factory, $this->tpl_factory, $this->lng, $this->js_binding);
109 
110  try {
111  $tpl = $r->_getTemplate("tpl.counter_foo.html", true, false);
112  $this->assertFalse("We should not get here");
113  } catch (\InvalidArgumentException $e) {};
114 
115  $expected = array
116  ( realpath(__DIR__."/../../src/UI/templates/default/Counter/tpl.counter_foo.html")
117  => array(true, false)
118  );
119  $this->assertEquals($expected, $this->tpl_factory->files);
120  }
global $tpl
Definition: ilias.php:8
$r
Definition: example_031.php:79
Create styles array
The data for the language used.

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