ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
PanelTest Class Reference

Test on button implementation. More...

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

Public Member Functions

 getUIFactory ()
 
 getPanelFactory ()
 
 testImplementsFactoryInterface ()
 
 testStandardGetTitle ()
 
 testStandardGetContent ()
 
 testStandardWithActions ()
 
 testSubWithActions ()
 
 testSubWithCard ()
 
 testSubWithSecondaryPanel ()
 
 testReportWithActions ()
 
 testReportGetTitle ()
 
 testReportGetContent ()
 
 testRenderStandard ()
 
 testRenderSub ()
 
 testRenderSubWithSecondaryPanel ()
 
 testRenderReport ()
 
 testStandardWithViewControls ()
 
 testReportWithViewControls ()
 
 testRenderReportWithMode ()
 
 testRenderWithSortation ()
 
 testRenderWithPagination ()
 

Detailed Description

Test on button implementation.

Definition at line 47 of file PanelTest.php.

Member Function Documentation

◆ getPanelFactory()

PanelTest::getPanelFactory ( )

◆ getUIFactory()

PanelTest::getUIFactory ( )

Definition at line 49 of file PanelTest.php.

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

References ILIAS\Repository\button(), and ILIAS\Repository\symbol().

Referenced by testRenderReportWithMode(), testRenderWithPagination(), testRenderWithSortation(), testReportWithViewControls(), and testStandardWithViewControls().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ testImplementsFactoryInterface()

PanelTest::testImplementsFactoryInterface ( )

Definition at line 87 of file PanelTest.php.

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

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

+ Here is the call graph for this function:

◆ testRenderReport()

PanelTest::testRenderReport ( )

Definition at line 335 of file PanelTest.php.

335 : void
336 {
337 $fp = $this->getPanelFactory();
338 $r = $this->getDefaultRenderer();
339
340 $actions = new I\Component\Dropdown\Standard(array(
341 new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
342 new I\Component\Button\Shy("GitHub", "https://www.github.com")
343 ));
344
345 $sub = $fp->sub("Title", array());
346 $card = new I\Component\Card\Card("Card Title");
347 $sub = $sub->withFurtherInformation($card);
348 $report = $fp->report("Title", $sub)->withActions($actions);
349
350 $html = $this->brutallyTrimHTML($r->render($report));
351
352 $expected_html = <<<EOT
353<div class="panel panel-primary il-panel-report panel-flex">
354 <div class="panel-heading ilHeader">
355 <div class="panel-title"><h2>Title</h2></div>
356 <div class="panel-controls">
357 <div class="dropdown" id="id_3"><button class="btn btn-default dropdown-toggle" type="button" aria-label="actions" aria-haspopup="true" aria-expanded="false" aria-controls="id_3_menu"><span class="caret"></span></button>
358 <ul id="id_3_menu" class="dropdown-menu">
359 <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
360 <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button></li>
361 </ul>
362 </div>
363 </div>
364 </div>
365 <div class="panel-body">
366 <div class="panel panel-sub panel-flex">
367 <div class="panel-heading ilBlockHeader">
368 <h3>Title</h3>
369 <div class="panel-controls"></div>
370 </div>
371 <div class="panel-body"><div class="row">
372 <div class="col-sm-8"></div>
373 <div class="col-sm-4">
374 <div class="il-card thumbnail">
375 <div class="card-no-highlight"></div>
376 <div class="caption card-title">Card Title</div>
377 </div>
378 </div>
379 </div>
380 </div>
381 </div>
382 </div>
383</div>
384EOT;
385
386 $this->assertHTMLEquals($this->brutallyTrimHTML($expected_html), $html);
387 }
Title class.
Definition: Title.php:42
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

References ILIAS\Repository\button(), and getPanelFactory().

+ Here is the call graph for this function:

◆ testRenderReportWithMode()

PanelTest::testRenderReportWithMode ( )

Definition at line 419 of file PanelTest.php.

419 : void
420 {
421 $modes = [
422 'A' => 'a',
423 'B' => 'b'
424 ];
425 $mode = $this->getUIFactory()->viewControl()->mode($modes, 'Presentation Mode');
426
427 $f = $this->getPanelFactory();
428 $r = $this->getDefaultRenderer();
429
430
431 $p = $f->report("Title", [])
432 ->withViewControls([$mode]);
433
434 $html = $r->render($p);
435
436 $expected_html = <<<EOT
437<div class="panel panel-primary il-panel-report panel-flex">
438 <div class="panel-heading ilHeader">
439 <div class="panel-title"><h2>Title</h2></div>
440 <div class="panel-viewcontrols l-bar__space-keeper">
441 <div class="il-viewcontrol-mode l-bar__element" aria-label="Presentation Mode" role="group">
442 <button class="btn btn-default engaged" aria-pressed="true" data-action="a" id="id_1">A</button>
443 <button class="btn btn-default" aria-pressed="false" data-action="b" id="id_2">B</button>
444 </div>
445 </div>
446 <div class="panel-controls"></div>
447 </div>
448 <div class="panel-body"></div>
449</div>
450EOT;
451 $this->assertEquals(
452 $this->brutallyTrimHTML($expected_html),
453 $this->brutallyTrimHTML($html)
454 );
455 }
getUIFactory()
Definition: PanelTest.php:49

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

+ Here is the call graph for this function:

◆ testRenderStandard()

PanelTest::testRenderStandard ( )

Definition at line 216 of file PanelTest.php.

216 : void
217 {
218 $f = $this->getPanelFactory();
219 $r = $this->getDefaultRenderer();
220
221 $actions = new I\Component\Dropdown\Standard(array(
222 new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
223 new I\Component\Button\Shy("GitHub", "https://www.github.com")
224 ));
225
226 $p = $f->standard("Title", array())->withActions($actions);
227
228 $html = $r->render($p);
229
230 $expected_html = <<<EOT
231<div class="panel panel-primary panel-flex">
232 <div class="panel-heading ilHeader">
233 <div class="panel-title"><h2>Title</h2></div>
234 <div class="panel-controls">
235 <div class="dropdown" id="id_3"><button class="btn btn-default dropdown-toggle" type="button" aria-label="actions" aria-haspopup="true" aria-expanded="false" aria-controls="id_3_menu"><span class="caret"></span></button>
236 <ul id="id_3_menu" class="dropdown-menu">
237 <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
238 <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button></li>
239 </ul>
240 </div>
241 </div>
242 </div>
243 <div class="panel-body"></div>
244</div>
245EOT;
246 $this->assertHTMLEquals($expected_html, $html);
247 }

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

+ Here is the call graph for this function:

◆ testRenderSub()

PanelTest::testRenderSub ( )

Definition at line 249 of file PanelTest.php.

249 : void
250 {
251 $fp = $this->getPanelFactory();
252 $r = $this->getDefaultRenderer();
253
254 $actions = new I\Component\Dropdown\Standard(array(
255 new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
256 new I\Component\Button\Shy("GitHub", "https://www.github.com")
257 ));
258
259 $p = $fp->sub("Title", array())->withActions($actions);
260 $card = new I\Component\Card\Card("Card Title");
261
262 $p = $p->withFurtherInformation($card);
263 $html = $this->brutallyTrimHTML($r->render($p));
264
265 $expected_html = <<<EOT
266<div class="panel panel-sub panel-flex">
267 <div class="panel-heading ilBlockHeader">
268 <h3>Title</h3>
269 <div class="panel-controls">
270 <div class="dropdown" id="id_3"><button class="btn btn-default dropdown-toggle" type="button" aria-label="actions" aria-haspopup="true" aria-expanded="false" aria-controls="id_3_menu"><span class="caret"></span></button>
271 <ul id="id_3_menu" class="dropdown-menu">
272 <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
273 <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button></li>
274 </ul>
275 </div>
276 </div>
277 </div>
278 <div class="panel-body">
279 <div class="row">
280 <div class="col-sm-8"></div>
281 <div class="col-sm-4">
282 <div class="il-card thumbnail">
283 <div class="card-no-highlight"></div>
284 <div class="caption card-title">Card Title</div>
285 </div>
286 </div>
287 </div>
288 </div>
289</div>
290EOT;
291
292 $this->assertHTMLEquals($this->brutallyTrimHTML($expected_html), $html);
293 }

References ILIAS\Repository\button(), and getPanelFactory().

+ Here is the call graph for this function:

◆ testRenderSubWithSecondaryPanel()

PanelTest::testRenderSubWithSecondaryPanel ( )

Definition at line 295 of file PanelTest.php.

295 : void
296 {
297 $fp = $this->getPanelFactory();
298 $r = $this->getDefaultRenderer();
299
300 $p = $fp->sub("Title", array());
301 $legacy = new I\Component\Legacy\Content("Legacy content", new SignalGenerator());
302 $secondary = new I\Component\Panel\Secondary\Legacy("Legacy panel title", $legacy);
303 $p = $p->withFurtherInformation($secondary);
304 $html = $r->render($p);
305
306 $expected_html = <<<EOT
307<div class="panel panel-sub panel-flex">
308 <div class="panel-heading ilBlockHeader">
309 <h3>Title</h3>
310 <div class="panel-controls"></div>
311 </div>
312 <div class="panel-body">
313 <div class="row">
314 <div class="col-sm-8"></div>
315 <div class="col-sm-4">
316 <div class="panel panel-secondary panel-flex">
317 <div class="panel-heading ilHeader">
318 <div class="panel-title"><h2>Legacy panel title</h2></div>
319 <div class="panel-controls"></div>
320 </div>
321 <div class="panel-body">Legacy content</div>
322 </div>
323 </div>
324 </div>
325 </div>
326</div>
327EOT;
328
329 $this->assertHTMLEquals(
330 $this->brutallyTrimHTML($expected_html),
331 $this->brutallyTrimHTML($html)
332 );
333 }

References getPanelFactory().

+ Here is the call graph for this function:

◆ testRenderWithPagination()

PanelTest::testRenderWithPagination ( )

Definition at line 502 of file PanelTest.php.

502 : void
503 {
504 $pagination = $this->getUIFactory()->viewControl()->pagination()
505 ->withTargetURL('http://ilias.de', 'page')
506 ->withTotalEntries(10)
507 ->withPageSize(2)
508 ->withCurrentPage(1);
509
510 $f = $this->getPanelFactory();
511 $r = $this->getDefaultRenderer();
512
513
514 $p = $f->standard("Title", [])
515 ->withViewControls([$pagination]);
516
517 $html = $r->render($p);
518
519 $expected_html = <<<EOT
520<div class="panel panel-primary panel-flex">
521 <div class="panel-heading ilHeader">
522 <div class="panel-title"><h2>Title</h2></div>
523 <div class="panel-viewcontrols l-bar__space-keeper">
524 <div class="il-viewcontrol-pagination l-bar__element">
525 <button class="btn btn-default" data-action="http://ilias.de?page=0" id="id_6">
526 <span class="glyph" aria-label="back" role="img"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span></span>
527 </button>
528 <button class="btn btn-link" data-action="http://ilias.de?page=0" id="id_1">1</button>
529 <button class="btn btn-link engaged" aria-pressed="true" data-action="http://ilias.de?page=1" id="id_2">2</button>
530 <button class="btn btn-link" data-action="http://ilias.de?page=2" id="id_3">3</button>
531 <button class="btn btn-link" data-action="http://ilias.de?page=3" id="id_4">4</button>
532 <button class="btn btn-link" data-action="http://ilias.de?page=4" id="id_5">5</button>
533 <button class="btn btn-default" data-action="http://ilias.de?page=2" id="id_7">
534 <span class="glyph" aria-label="next" role="img"><span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></span>
535 </button>
536 </div>
537 </div>
538 <div class="panel-controls"></div>
539 </div>
540 <div class="panel-body"></div>
541</div>
542EOT;
543 $this->assertEquals(
544 $this->brutallyTrimHTML($expected_html),
545 $this->brutallyTrimHTML($html)
546 );
547 }

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

+ Here is the call graph for this function:

◆ testRenderWithSortation()

PanelTest::testRenderWithSortation ( )

Definition at line 457 of file PanelTest.php.

457 : void
458 {
459 $sort_options = [
460 'a' => 'A',
461 'b' => 'B'
462 ];
463
464 $sortation = $this->getUIFactory()->viewControl()->sortation($sort_options, 'b');
465
466 $f = $this->getPanelFactory();
467 $r = $this->getDefaultRenderer();
468
469
470 $p = $f->standard("Title", [])
471 ->withViewControls([$sortation]);
472
473 $html = $r->render($p);
474
475 $expected_html = <<<EOT
476<div class="panel panel-primary panel-flex">
477 <div class="panel-heading ilHeader">
478 <div class="panel-title"><h2>Title</h2></div>
479 <div class="panel-viewcontrols l-bar__space-keeper">
480 <div class="dropdown il-viewcontrol il-viewcontrol-sortation l-bar__element" id="id_1">
481 <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-label="sortation" aria-haspopup="true" aria-expanded="false" aria-controls="id_1_ctrl">
482 <span class="label">vc_sort B</span>
483 <span class="glyphicon-sort"></span>
484 </button>
485 <ul id="id_1_ctrl" class="dropdown-menu">
486 <li><button class="btn btn-link" data-action="?sortation=a" id="id_2">A</button></li>
487 <li class="selected"><button class="btn btn-link" data-action="?sortation=b" id="id_3">B</button></li>
488 </ul>
489 </div>
490 </div>
491 <div class="panel-controls"></div>
492 </div>
493 <div class="panel-body"></div>
494</div>
495EOT;
496 $this->assertEquals(
497 $this->brutallyTrimHTML($expected_html),
498 $this->brutallyTrimHTML($html)
499 );
500 }

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

+ Here is the call graph for this function:

◆ testReportGetContent()

PanelTest::testReportGetContent ( )

Definition at line 207 of file PanelTest.php.

207 : void
208 {
209 $f = $this->getPanelFactory();
210 $sub = $f->sub("Title", array(new ComponentDummy()));
211 $p = $f->report("Title", [$sub]);
212
213 $this->assertEquals($p->getContent(), array($sub));
214 }

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

+ Here is the call graph for this function:

◆ testReportGetTitle()

PanelTest::testReportGetTitle ( )

Definition at line 198 of file PanelTest.php.

198 : void
199 {
200 $f = $this->getPanelFactory();
201 $sub = $f->sub("Title", array(new ComponentDummy()));
202 $p = $f->report("Title", array($sub));
203
204 $this->assertEquals("Title", $p->getTitle());
205 }

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

+ Here is the call graph for this function:

◆ testReportWithActions()

PanelTest::testReportWithActions ( )

Definition at line 182 of file PanelTest.php.

182 : void
183 {
184 $fp = $this->getPanelFactory();
185
186 $p = $fp->report("Title", $fp->sub("Title", array(new ComponentDummy())));
187
188 $actions = new I\Component\Dropdown\Standard(array(
189 new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
190 new I\Component\Button\Shy("GitHub", "https://www.github.com")
191 ));
192
193 $p = $p->withActions($actions);
194
195 $this->assertEquals($p->getActions(), $actions);
196 }

References getPanelFactory().

+ Here is the call graph for this function:

◆ testReportWithViewControls()

PanelTest::testReportWithViewControls ( )

Definition at line 404 of file PanelTest.php.

404 : void
405 {
406 $sort_options = [
407 'a' => 'A',
408 'b' => 'B'
409 ];
410 $sortation = $this->getUIFactory()->viewControl()->sortation($sort_options, 'a');
411 $f = $this->getPanelFactory();
412 $p = $f->report("Title", [])
413 ->withViewControls([$sortation])
414 ;
415
416 $this->assertEquals($p->getViewControls(), [$sortation]);
417 }

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

+ Here is the call graph for this function:

◆ testStandardGetContent()

PanelTest::testStandardGetContent ( )

Definition at line 114 of file PanelTest.php.

114 : void
115 {
116 $f = $this->getPanelFactory();
117 $c = new ComponentDummy();
118 $p = $f->standard("Title", array($c));
119
120 $this->assertEquals($p->getContent(), array($c));
121 }
$c
Definition: deliver.php:25

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

+ Here is the call graph for this function:

◆ testStandardGetTitle()

PanelTest::testStandardGetTitle ( )

Definition at line 106 of file PanelTest.php.

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

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

+ Here is the call graph for this function:

◆ testStandardWithActions()

PanelTest::testStandardWithActions ( )

Definition at line 123 of file PanelTest.php.

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

References getPanelFactory().

+ Here is the call graph for this function:

◆ testStandardWithViewControls()

PanelTest::testStandardWithViewControls ( )

Definition at line 389 of file PanelTest.php.

389 : void
390 {
391 $sort_options = [
392 'a' => 'A',
393 'b' => 'B'
394 ];
395 $sortation = $this->getUIFactory()->viewControl()->sortation($sort_options, 'a');
396 $f = $this->getPanelFactory();
397 $p = $f->standard("Title", [])
398 ->withViewControls([$sortation])
399 ;
400
401 $this->assertEquals($p->getViewControls(), [$sortation]);
402 }

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

+ Here is the call graph for this function:

◆ testSubWithActions()

PanelTest::testSubWithActions ( )

Definition at line 139 of file PanelTest.php.

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

References getPanelFactory().

+ Here is the call graph for this function:

◆ testSubWithCard()

PanelTest::testSubWithCard ( )

Definition at line 155 of file PanelTest.php.

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

References getPanelFactory().

+ Here is the call graph for this function:

◆ testSubWithSecondaryPanel()

PanelTest::testSubWithSecondaryPanel ( )

Definition at line 168 of file PanelTest.php.

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

References getPanelFactory().

+ Here is the call graph for this function:

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