ILIAS  release_8 Revision v8.24
PanelTest Class Reference

Test on button implementation. More...

+ Inheritance diagram for PanelTest:
+ Collaboration diagram for PanelTest:

Public Member Functions

 getUIFactory ()
 
 getPanelFactory ()
 
 test_implements_factory_interface ()
 
 test_standard_get_title ()
 
 test_standard_get_content ()
 
 test_standard_with_actions ()
 
 test_sub_with_actions ()
 
 test_sub_with_card ()
 
 test_sub_with_secondary_panel ()
 
 test_report_get_title ()
 
 test_report_get_content ()
 
 test_render_standard ()
 
 test_render_sub ()
 
 test_render_sub_with_secondary_panel ()
 
 test_render_report ()
 
 test_with_view_controls ()
 
 test_render_with_sortation ()
 
 test_render_with_pagination ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML (string $html)
 
 assertHTMLEquals (string $expected_html_as_string, string $html_as_string)
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML (string $html)
 A more radical version of normalizeHTML. More...
 
 brutallyTrimSignals (string $html)
 A naive replacement of all il_signal-ids with dots to ease comparisons of rendered output. More...
 

Detailed Description

Test on button implementation.

Definition at line 45 of file PanelTest.php.

Member Function Documentation

◆ getPanelFactory()

PanelTest::getPanelFactory ( )

Definition at line 77 of file PanelTest.php.

77 : I\Component\Panel\Factory
78 {
79 return new I\Component\Panel\Factory(
80 $this->createMock(C\Panel\Listing\Factory::class)
81 );
82 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

Referenced by test_implements_factory_interface(), test_render_report(), test_render_standard(), test_render_sub(), test_render_sub_with_secondary_panel(), test_render_with_pagination(), test_render_with_sortation(), test_report_get_content(), test_report_get_title(), test_standard_get_content(), test_standard_get_title(), test_standard_with_actions(), test_sub_with_actions(), test_sub_with_card(), test_sub_with_secondary_panel(), and test_with_view_controls().

+ Here is the caller graph for this function:

◆ getUIFactory()

PanelTest::getUIFactory ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 47 of file PanelTest.php.

48 {
49 return new class () extends NoUIFactory {
50 public function panelSecondary(): I\Component\Panel\Secondary\Factory
51 {
52 return new I\Component\Panel\Secondary\Factory();
53 }
54 public function dropdown(): I\Component\Dropdown\Factory
55 {
56 return new I\Component\Dropdown\Factory();
57 }
58 public function viewControl(): I\Component\ViewControl\Factory
59 {
60 return new I\Component\ViewControl\Factory(new SignalGenerator());
61 }
62 public function button(): I\Component\Button\Factory
63 {
64 return new I\Component\Button\Factory();
65 }
66 public function symbol(): C\Symbol\Factory
67 {
68 return new I\Component\Symbol\Factory(
69 new I\Component\Symbol\Icon\Factory(),
70 new I\Component\Symbol\Glyph\Factory(),
71 new I\Component\Symbol\Avatar\Factory()
72 );
73 }
74 };
75 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

Referenced by test_render_with_pagination(), test_render_with_sortation(), and test_with_view_controls().

+ Here is the caller graph for this function:

◆ test_implements_factory_interface()

PanelTest::test_implements_factory_interface ( )

Definition at line 84 of file PanelTest.php.

84 : void
85 {
86 $f = $this->getPanelFactory();
87
88 $this->assertInstanceOf("ILIAS\\UI\\Component\\Panel\\Factory", $f);
89 $this->assertInstanceOf(
90 "ILIAS\\UI\\Component\\Panel\\Standard",
91 $f->standard("Title", array(new ComponentDummy()))
92 );
93 $this->assertInstanceOf(
94 "ILIAS\\UI\\Component\\Panel\\Sub",
95 $f->sub("Title", array(new ComponentDummy()))
96 );
97 $this->assertInstanceOf(
98 "ILIAS\\UI\\Component\\Panel\\Report",
99 $f->report("Title", $f->sub("Title", array(new ComponentDummy())))
100 );
101 }
getPanelFactory()
Definition: PanelTest.php:77

References Vendor\Package\$f, and getPanelFactory().

+ Here is the call graph for this function:

◆ test_render_report()

PanelTest::test_render_report ( )

Definition at line 309 of file PanelTest.php.

309 : void
310 {
311 $fp = $this->getPanelFactory();
312 $r = $this->getDefaultRenderer();
313 $sub = $fp->sub("Title", array());
314 $card = new I\Component\Card\Card("Card Title");
315 $sub = $sub->withFurtherInformation($card);
316 $report = $fp->report("Title", $sub);
317
318 $html = $this->brutallyTrimHTML($r->render($report));
319
320 $expected_html = <<<EOT
321<div class="panel panel-primary il-panel-report panel-flex">
322 <div class="panel-heading ilHeader">
323 <h2>Title</h2>
324 </div>
325 <div class="panel-body">
326 <div class="panel panel-sub panel-flex">
327 <div class="panel-heading ilBlockHeader">
328 <h3>Title</h3>
329 </div>
330 <div class="panel-body"><div class="row">
331 <div class="col-sm-8"></div>
332 <div class="col-sm-4">
333 <div class="il-card thumbnail">
334 <div class="card-no-highlight"></div>
335 <div class="caption card-title">Card Title</div>
336 </div>
337 </div>
338 </div>
339 </div>
340 </div>
341 </div>
342</div>
343EOT;
344
345 $this->assertHTMLEquals($this->brutallyTrimHTML($expected_html), $html);
346 }
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
Title class.
Definition: Title.php:27

References ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getPanelFactory().

+ Here is the call graph for this function:

◆ test_render_standard()

PanelTest::test_render_standard ( )

Definition at line 196 of file PanelTest.php.

196 : void
197 {
198 $f = $this->getPanelFactory();
199 $r = $this->getDefaultRenderer();
200
201 $actions = new I\Component\Dropdown\Standard(array(
202 new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
203 new I\Component\Button\Shy("GitHub", "https://www.github.com")
204 ));
205
206 $p = $f->standard("Title", array())->withActions($actions);
207
208 $html = $r->render($p);
209
210 $expected_html = <<<EOT
211<div class="panel panel-primary panel-flex">
212 <div class="panel-heading ilHeader">
213 <h2>Title</h2>
214 <div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" id="id_3" aria-label="actions" aria-haspopup="true" aria-expanded="false" aria-controls="id_3_menu"> <span class="caret"></span></button>
215 <ul id="id_3_menu" class="dropdown-menu">
216 <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
217 <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button></li>
218 </ul>
219 </div>
220 </div>
221 <div class="panel-body"></div>
222</div>
223EOT;
224 $this->assertHTMLEquals($expected_html, $html);
225 }
Class ChatMainBarProvider \MainMenu\Provider.

References Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\getDefaultRenderer(), and getPanelFactory().

+ Here is the call graph for this function:

◆ test_render_sub()

PanelTest::test_render_sub ( )

Definition at line 227 of file PanelTest.php.

227 : void
228 {
229 $fp = $this->getPanelFactory();
230 $r = $this->getDefaultRenderer();
231
232 $actions = new I\Component\Dropdown\Standard(array(
233 new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
234 new I\Component\Button\Shy("GitHub", "https://www.github.com")
235 ));
236
237 $p = $fp->sub("Title", array())->withActions($actions);
238 $card = new I\Component\Card\Card("Card Title");
239
240 $p = $p->withFurtherInformation($card);
241 $html = $this->brutallyTrimHTML($r->render($p));
242
243 $expected_html = <<<EOT
244<div class="panel panel-sub panel-flex">
245 <div class="panel-heading ilBlockHeader">
246 <h3>Title</h3>
247 <div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" id="id_3" aria-label="actions" aria-haspopup="true" aria-expanded="false" aria-controls="id_3_menu"> <span class="caret"></span></button>
248 <ul id="id_3_menu" class="dropdown-menu">
249 <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
250 <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button></li>
251 </ul>
252 </div>
253 </div>
254 <div class="panel-body">
255 <div class="row">
256 <div class="col-sm-8"></div>
257 <div class="col-sm-4">
258 <div class="il-card thumbnail">
259 <div class="card-no-highlight"></div>
260 <div class="caption card-title">Card Title</div>
261 </div>
262 </div>
263 </div>
264 </div>
265</div>
266EOT;
267
268 $this->assertHTMLEquals($this->brutallyTrimHTML($expected_html), $html);
269 }

References ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getPanelFactory().

+ Here is the call graph for this function:

◆ test_render_sub_with_secondary_panel()

PanelTest::test_render_sub_with_secondary_panel ( )

Definition at line 271 of file PanelTest.php.

271 : void
272 {
273 $fp = $this->getPanelFactory();
274 $r = $this->getDefaultRenderer();
275
276 $p = $fp->sub("Title", array());
277 $legacy = new I\Component\Legacy\Legacy("Legacy content", new SignalGenerator());
278 $secondary = new I\Component\Panel\Secondary\Legacy("Legacy panel title", $legacy);
279 $p = $p->withFurtherInformation($secondary);
280 $html = $r->render($p);
281
282 $expected_html = <<<EOT
283<div class="panel panel-sub panel-flex">
284 <div class="panel-heading ilBlockHeader">
285 <h3>Title</h3>
286 </div>
287 <div class="panel-body">
288 <div class="row">
289 <div class="col-sm-8"></div>
290 <div class="col-sm-4">
291 <div class="panel panel-secondary panel-flex">
292 <div class="panel-heading ilHeader">
293 <h2>Legacy panel title</h2>
294 </div>
295 <div class="panel-body">Legacy content</div>
296 </div>
297 </div>
298 </div>
299 </div>
300</div>
301EOT;
302
303 $this->assertHTMLEquals(
304 $this->brutallyTrimHTML($expected_html),
305 $this->brutallyTrimHTML($html)
306 );
307 }

References ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getPanelFactory().

+ Here is the call graph for this function:

◆ test_render_with_pagination()

PanelTest::test_render_with_pagination ( )

Definition at line 402 of file PanelTest.php.

402 : void
403 {
404 $pagination = $this->getUIFactory()->viewControl()->pagination()
405 ->withTargetURL('http://ilias.de', 'page')
406 ->withTotalEntries(10)
407 ->withPageSize(2)
408 ->withCurrentPage(1);
409
410 $f = $this->getPanelFactory();
411 $r = $this->getDefaultRenderer();
412
413
414 $p = $f->standard("Title", [])
415 ->withViewControls([$pagination]);
416
417 $html = $r->render($p);
418
419 $expected_html = <<<EOT
420<div class="panel panel-primary panel-flex">
421 <div class="panel-heading ilHeader">
422 <h2>Title</h2>
423 <div class="il-viewcontrol-pagination">
424 <span class="browse previous">
425 <a tabindex="0" class="glyph" href="http://ilias.de?page=0" aria-label="back">
426 <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
427 </a>
428 </span>
429 <button class="btn btn-link" data-action="http://ilias.de?page=0" id="id_1">1</button>
430 <button class="btn btn-link engaged" aria-pressed="true" data-action="http://ilias.de?page=1" id="id_2">2</button>
431 <button class="btn btn-link" data-action="http://ilias.de?page=2" id="id_3">3</button>
432 <button class="btn btn-link" data-action="http://ilias.de?page=3" id="id_4">4</button>
433 <button class="btn btn-link" data-action="http://ilias.de?page=4" id="id_5">5</button>
434 <span class="browse next">
435 <a tabindex="0" class="glyph" href="http://ilias.de?page=2" aria-label="next">
436 <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
437 </a>
438 </span>
439 </div>
440 </div>
441 <div class="panel-body"></div>
442</div>
443EOT;
444 $this->assertHTMLEquals($this->brutallyTrimHTML($expected_html), $this->brutallyTrimHTML($html));
445 }
getUIFactory()
Definition: PanelTest.php:47

References Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), getPanelFactory(), and getUIFactory().

+ Here is the call graph for this function:

◆ test_render_with_sortation()

PanelTest::test_render_with_sortation ( )

Definition at line 363 of file PanelTest.php.

363 : void
364 {
365 $sort_options = [
366 'a' => 'A',
367 'b' => 'B'
368 ];
369 $sortation = $this->getUIFactory()->viewControl()->sortation($sort_options);
370
371 $f = $this->getPanelFactory();
372 $r = $this->getDefaultRenderer();
373
374
375 $p = $f->standard("Title", [])
376 ->withViewControls([$sortation]);
377 ;
378
379 $html = $r->render($p);
380
381 $expected_html = <<<EOT
382<div class="panel panel-primary panel-flex">
383 <div class="panel-heading ilHeader">
384 <h2>Title</h2>
385 <div class="il-viewcontrol-sortation" id="id_1">
386<div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" id="id_4" aria-label="actions" aria-haspopup="true" aria-expanded="false" aria-controls="id_4_menu"> <span class="caret"></span></button>
387<ul id="id_4_menu" class="dropdown-menu">
388 <li><button class="btn btn-link" data-action="?sortation=a" id="id_2">A</button>
389</li>
390 <li><button class="btn btn-link" data-action="?sortation=b" id="id_3">B</button>
391</li>
392</ul>
393</div>
394</div>
395 </div>
396 <div class="panel-body"></div>
397</div>
398EOT;
399 $this->assertHTMLEquals($expected_html, $html);
400 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Breadcrumbs.php:21
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Avatar.php:21

References Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\getDefaultRenderer(), getPanelFactory(), and getUIFactory().

+ Here is the call graph for this function:

◆ test_report_get_content()

PanelTest::test_report_get_content ( )

Definition at line 188 of file PanelTest.php.

188 : void
189 {
190 $f = $this->getPanelFactory();
191 $sub = $f->sub("Title", array(new ComponentDummy()));
192 $p = $f->report("Title", [$sub]);
193
194 $this->assertEquals($p->getContent(), array($sub));
195 }

References Vendor\Package\$f, and getPanelFactory().

+ Here is the call graph for this function:

◆ test_report_get_title()

PanelTest::test_report_get_title ( )

Definition at line 179 of file PanelTest.php.

179 : void
180 {
181 $f = $this->getPanelFactory();
182 $sub = $f->sub("Title", array(new ComponentDummy()));
183 $p = $f->report("Title", array($sub));
184
185 $this->assertEquals("Title", $p->getTitle());
186 }

References Vendor\Package\$f, and getPanelFactory().

+ Here is the call graph for this function:

◆ test_standard_get_content()

PanelTest::test_standard_get_content ( )

Definition at line 111 of file PanelTest.php.

111 : void
112 {
113 $f = $this->getPanelFactory();
114 $c = new ComponentDummy();
115 $p = $f->standard("Title", array($c));
116
117 $this->assertEquals($p->getContent(), array($c));
118 }
$c
Definition: cli.php:38

References $c, Vendor\Package\$f, and getPanelFactory().

+ Here is the call graph for this function:

◆ test_standard_get_title()

PanelTest::test_standard_get_title ( )

Definition at line 103 of file PanelTest.php.

103 : void
104 {
105 $f = $this->getPanelFactory();
106 $p = $f->standard("Title", array(new ComponentDummy()));
107
108 $this->assertEquals("Title", $p->getTitle());
109 }

References Vendor\Package\$f, and getPanelFactory().

+ Here is the call graph for this function:

◆ test_standard_with_actions()

PanelTest::test_standard_with_actions ( )

Definition at line 120 of file PanelTest.php.

120 : void
121 {
122 $fp = $this->getPanelFactory();
123
124 $p = $fp->standard("Title", array(new ComponentDummy()));
125
126 $actions = new I\Component\Dropdown\Standard(array(
127 new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
128 new I\Component\Button\Shy("GitHub", "https://www.github.com")
129 ));
130
131 $p = $p->withActions($actions);
132
133 $this->assertEquals($p->getActions(), $actions);
134 }

References getPanelFactory().

+ Here is the call graph for this function:

◆ test_sub_with_actions()

PanelTest::test_sub_with_actions ( )

Definition at line 136 of file PanelTest.php.

136 : void
137 {
138 $fp = $this->getPanelFactory();
139
140 $p = $fp->sub("Title", array(new ComponentDummy()));
141
142 $actions = new I\Component\Dropdown\Standard(array(
143 new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
144 new I\Component\Button\Shy("GitHub", "https://www.github.com")
145 ));
146
147 $p = $p->withActions($actions);
148
149 $this->assertEquals($p->getActions(), $actions);
150 }

References getPanelFactory().

+ Here is the call graph for this function:

◆ test_sub_with_card()

PanelTest::test_sub_with_card ( )

Definition at line 152 of file PanelTest.php.

152 : void
153 {
154 $fp = $this->getPanelFactory();
155
156 $p = $fp->sub("Title", array(new ComponentDummy()));
157
158 $card = new I\Component\Card\Card("Card Title");
159
160 $p = $p->withFurtherInformation($card);
161
162 $this->assertEquals($p->getFurtherInformation(), $card);
163 }

References getPanelFactory().

+ Here is the call graph for this function:

◆ test_sub_with_secondary_panel()

PanelTest::test_sub_with_secondary_panel ( )

Definition at line 165 of file PanelTest.php.

165 : void
166 {
167 $fp = $this->getPanelFactory();
168
169 $p = $fp->sub("Title", array(new ComponentDummy()));
170
171 $legacy = new I\Component\Legacy\Legacy("Legacy content", new SignalGenerator());
172 $secondary = new I\Component\Panel\Secondary\Legacy("Legacy panel title", $legacy);
173
174 $p = $p->withFurtherInformation($secondary);
175
176 $this->assertEquals($p->getFurtherInformation(), $secondary);
177 }

References getPanelFactory().

+ Here is the call graph for this function:

◆ test_with_view_controls()

PanelTest::test_with_view_controls ( )

Definition at line 348 of file PanelTest.php.

348 : void
349 {
350 $sort_options = [
351 'a' => 'A',
352 'b' => 'B'
353 ];
354 $sortation = $this->getUIFactory()->viewControl()->sortation($sort_options);
355 $f = $this->getPanelFactory();
356 $p = $f->standard("Title", [])
357 ->withViewControls([$sortation])
358 ;
359
360 $this->assertEquals($p->getViewControls(), [$sortation]);
361 }

References Vendor\Package\$f, getPanelFactory(), and getUIFactory().

+ Here is the call graph for this function:

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