ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 ()
 
 testReportGetTitle ()
 
 testReportGetContent ()
 
 testRenderStandard ()
 
 testRenderSub ()
 
 testRenderSubWithSecondaryPanel ()
 
 testRenderReport ()
 
 testWithViewControls ()
 
 testRenderWithSortation ()
 
 testRenderWithPagination ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 getHelpTextRetriever ()
 
 getUploadLimitResolver ()
 
 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...

◆ getUIFactory()

PanelTest::getUIFactory ( )

Definition at line 47 of file PanelTest.php.

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

47  : NoUIFactory
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  }
button(string $caption, string $cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ testImplementsFactoryInterface()

PanelTest::testImplementsFactoryInterface ( )

Definition at line 84 of file PanelTest.php.

References Vendor\Package\$f.

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

◆ testRenderReport()

PanelTest::testRenderReport ( )

Definition at line 315 of file PanelTest.php.

References $r.

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

◆ testRenderStandard()

PanelTest::testRenderStandard ( )

Definition at line 196 of file PanelTest.php.

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

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  <div class="panel-title"><h2>Title</h2></div>
214  <div class="panel-controls">
215  <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>
216  <ul id="id_3_menu" class="dropdown-menu">
217  <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
218  <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button></li>
219  </ul>
220  </div>
221  </div>
222  </div>
223  <div class="panel-body"></div>
224 </div>
225 EOT;
226  $this->assertHTMLEquals($expected_html, $html);
227  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
button(string $caption, string $cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Title class.
Definition: Title.php:26
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:458
getPanelFactory()
Definition: PanelTest.php:77
$r
+ Here is the call graph for this function:

◆ testRenderSub()

PanelTest::testRenderSub ( )

Definition at line 229 of file PanelTest.php.

References $r, and ILIAS\Repository\button().

229  : void
230  {
231  $fp = $this->getPanelFactory();
232  $r = $this->getDefaultRenderer();
233 
234  $actions = new I\Component\Dropdown\Standard(array(
235  new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
236  new I\Component\Button\Shy("GitHub", "https://www.github.com")
237  ));
238 
239  $p = $fp->sub("Title", array())->withActions($actions);
240  $card = new I\Component\Card\Card("Card Title");
241 
242  $p = $p->withFurtherInformation($card);
243  $html = $this->brutallyTrimHTML($r->render($p));
244 
245  $expected_html = <<<EOT
246 <div class="panel panel-sub panel-flex">
247  <div class="panel-heading ilBlockHeader">
248  <h3>Title</h3>
249  <div class="panel-controls">
250  <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>
251  <ul id="id_3_menu" class="dropdown-menu">
252  <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
253  <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button></li>
254  </ul>
255  </div>
256  </div>
257  </div>
258  <div class="panel-body">
259  <div class="row">
260  <div class="col-sm-8"></div>
261  <div class="col-sm-4">
262  <div class="il-card thumbnail">
263  <div class="card-no-highlight"></div>
264  <div class="caption card-title">Card Title</div>
265  </div>
266  </div>
267  </div>
268  </div>
269 </div>
270 EOT;
271 
272  $this->assertHTMLEquals($this->brutallyTrimHTML($expected_html), $html);
273  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
button(string $caption, string $cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Title class.
Definition: Title.php:26
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:458
getPanelFactory()
Definition: PanelTest.php:77
$r
+ Here is the call graph for this function:

◆ testRenderSubWithSecondaryPanel()

PanelTest::testRenderSubWithSecondaryPanel ( )

Definition at line 275 of file PanelTest.php.

References $r.

275  : void
276  {
277  $fp = $this->getPanelFactory();
278  $r = $this->getDefaultRenderer();
279 
280  $p = $fp->sub("Title", array());
281  $legacy = new I\Component\Legacy\Legacy("Legacy content", new SignalGenerator());
282  $secondary = new I\Component\Panel\Secondary\Legacy("Legacy panel title", $legacy);
283  $p = $p->withFurtherInformation($secondary);
284  $html = $r->render($p);
285 
286  $expected_html = <<<EOT
287 <div class="panel panel-sub panel-flex">
288  <div class="panel-heading ilBlockHeader">
289  <h3>Title</h3>
290  <div class="panel-controls"></div>
291  </div>
292  <div class="panel-body">
293  <div class="row">
294  <div class="col-sm-8"></div>
295  <div class="col-sm-4">
296  <div class="panel panel-secondary panel-flex">
297  <div class="panel-heading ilHeader">
298  <div class="panel-title"><h2>Legacy panel title</h2></div>
299  <div class="panel-controls"></div>
300  </div>
301  <div class="panel-body">Legacy content</div>
302  </div>
303  </div>
304  </div>
305  </div>
306 </div>
307 EOT;
308 
309  $this->assertHTMLEquals(
310  $this->brutallyTrimHTML($expected_html),
311  $this->brutallyTrimHTML($html)
312  );
313  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
Title class.
Definition: Title.php:26
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:458
getPanelFactory()
Definition: PanelTest.php:77
$r

◆ testRenderWithPagination()

PanelTest::testRenderWithPagination ( )

Definition at line 412 of file PanelTest.php.

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

412  : void
413  {
414  $pagination = $this->getUIFactory()->viewControl()->pagination()
415  ->withTargetURL('http://ilias.de', 'page')
416  ->withTotalEntries(10)
417  ->withPageSize(2)
418  ->withCurrentPage(1);
419 
420  $f = $this->getPanelFactory();
421  $r = $this->getDefaultRenderer();
422 
423 
424  $p = $f->standard("Title", [])
425  ->withViewControls([$pagination]);
426 
427  $html = $r->render($p);
428 
429  $expected_html = <<<EOT
430 <div class="panel panel-primary panel-flex">
431  <div class="panel-heading ilHeader">
432  <div class="panel-title"><h2>Title</h2></div>
433  <div class="panel-viewcontrols l-bar__space-keeper">
434  <div class="il-viewcontrol-pagination l-bar__element">
435  <span class="btn btn-ctrl browse previous">
436  <a tabindex="0" class="glyph" href="http://ilias.de?page=0" aria-label="back">
437  <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
438  </a>
439  </span>
440  <button class="btn btn-link" data-action="http://ilias.de?page=0" id="id_1">1</button>
441  <button class="btn btn-link engaged" aria-pressed="true" data-action="http://ilias.de?page=1" id="id_2">2</button>
442  <button class="btn btn-link" data-action="http://ilias.de?page=2" id="id_3">3</button>
443  <button class="btn btn-link" data-action="http://ilias.de?page=3" id="id_4">4</button>
444  <button class="btn btn-link" data-action="http://ilias.de?page=4" id="id_5">5</button>
445  <span class="btn btn-ctrl browse next">
446  <a tabindex="0" class="glyph" href="http://ilias.de?page=2" aria-label="next">
447  <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
448  </a>
449  </span>
450  </div>
451  </div>
452  <div class="panel-controls"></div>
453  </div>
454  <div class="panel-body"></div>
455 </div>
456 EOT;
457  $this->assertEquals(
458  $this->brutallyTrimHTML($expected_html),
459  $this->brutallyTrimHTML($html)
460  );
461  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
button(string $caption, string $cmd)
Title class.
Definition: Title.php:26
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
getPanelFactory()
Definition: PanelTest.php:77
getUIFactory()
Definition: PanelTest.php:47
$r
+ Here is the call graph for this function:

◆ testRenderWithSortation()

PanelTest::testRenderWithSortation ( )

Definition at line 370 of file PanelTest.php.

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

370  : void
371  {
372  $sort_options = [
373  'a' => 'A',
374  'b' => 'B'
375  ];
376  $sortation = $this->getUIFactory()->viewControl()->sortation($sort_options);
377 
378  $f = $this->getPanelFactory();
379  $r = $this->getDefaultRenderer();
380 
381 
382  $p = $f->standard("Title", [])
383  ->withViewControls([$sortation]);
384 
385  $html = $r->render($p);
386 
387  $expected_html = <<<EOT
388 <div class="panel panel-primary panel-flex">
389  <div class="panel-heading ilHeader">
390  <div class="panel-title"><h2>Title</h2></div>
391  <div class="panel-viewcontrols l-bar__space-keeper">
392  <div class="il-viewcontrol-sortation l-bar__element" id="id_1">
393  <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>
394  <ul id="id_4_menu" class="dropdown-menu">
395  <li><button class="btn btn-link" data-action="?sortation=a" id="id_2">A</button></li>
396  <li><button class="btn btn-link" data-action="?sortation=b" id="id_3">B</button></li>
397  </ul>
398  </div>
399  </div>
400  </div>
401  <div class="panel-controls"></div>
402  </div>
403  <div class="panel-body"></div>
404 </div>
405 EOT;
406  $this->assertEquals(
407  $this->brutallyTrimHTML($expected_html),
408  $this->brutallyTrimHTML($html)
409  );
410  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Avatar.php:21
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
button(string $caption, string $cmd)
Title class.
Definition: Title.php:26
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
getPanelFactory()
Definition: PanelTest.php:77
getUIFactory()
Definition: PanelTest.php:47
$r
+ Here is the call graph for this function:

◆ testReportGetContent()

PanelTest::testReportGetContent ( )

Definition at line 188 of file PanelTest.php.

References Vendor\Package\$f.

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  }
getPanelFactory()
Definition: PanelTest.php:77

◆ testReportGetTitle()

PanelTest::testReportGetTitle ( )

Definition at line 179 of file PanelTest.php.

References Vendor\Package\$f.

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  }
getPanelFactory()
Definition: PanelTest.php:77

◆ testStandardGetContent()

PanelTest::testStandardGetContent ( )

Definition at line 111 of file PanelTest.php.

References Vendor\Package\$c, and Vendor\Package\$f.

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  }
getPanelFactory()
Definition: PanelTest.php:77

◆ testStandardGetTitle()

PanelTest::testStandardGetTitle ( )

Definition at line 103 of file PanelTest.php.

References Vendor\Package\$f.

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

◆ testStandardWithActions()

PanelTest::testStandardWithActions ( )

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  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getPanelFactory()
Definition: PanelTest.php:77

◆ testSubWithActions()

PanelTest::testSubWithActions ( )

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  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getPanelFactory()
Definition: PanelTest.php:77

◆ testSubWithCard()

PanelTest::testSubWithCard ( )

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  }
getPanelFactory()
Definition: PanelTest.php:77

◆ testSubWithSecondaryPanel()

PanelTest::testSubWithSecondaryPanel ( )

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  }
getPanelFactory()
Definition: PanelTest.php:77

◆ testWithViewControls()

PanelTest::testWithViewControls ( )

Definition at line 355 of file PanelTest.php.

References Vendor\Package\$f.

355  : void
356  {
357  $sort_options = [
358  'a' => 'A',
359  'b' => 'B'
360  ];
361  $sortation = $this->getUIFactory()->viewControl()->sortation($sort_options);
362  $f = $this->getPanelFactory();
363  $p = $f->standard("Title", [])
364  ->withViewControls([$sortation])
365  ;
366 
367  $this->assertEquals($p->getViewControls(), [$sortation]);
368  }
getPanelFactory()
Definition: PanelTest.php:77
getUIFactory()
Definition: PanelTest.php:47

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