ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 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(I\Component\Panel\Listing\Factory::class),
81  $this->createMock(I\Component\Panel\Secondary\Factory::class),
82  );
83  }

◆ 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(): I\Component\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)
+ Here is the call graph for this function:

◆ testImplementsFactoryInterface()

PanelTest::testImplementsFactoryInterface ( )

Definition at line 85 of file PanelTest.php.

References Vendor\Package\$f.

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

◆ testRenderReport()

PanelTest::testRenderReport ( )

Definition at line 333 of file PanelTest.php.

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

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

◆ testRenderReportWithMode()

PanelTest::testRenderReportWithMode ( )

Definition at line 417 of file PanelTest.php.

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

417  : void
418  {
419  $modes = [
420  'A' => 'a',
421  'B' => 'b'
422  ];
423  $mode = $this->getUIFactory()->viewControl()->mode($modes, 'Presentation Mode');
424 
425  $f = $this->getPanelFactory();
426  $r = $this->getDefaultRenderer();
427 
428 
429  $p = $f->report("Title", [])
430  ->withViewControls([$mode]);
431 
432  $html = $r->render($p);
433 
434  $expected_html = <<<EOT
435 <div class="panel panel-primary il-panel-report panel-flex">
436  <div class="panel-heading ilHeader">
437  <div class="panel-title"><h2>Title</h2></div>
438  <div class="panel-viewcontrols l-bar__space-keeper">
439  <div class="il-viewcontrol-mode l-bar__element" aria-label="Presentation Mode" role="group">
440  <button class="btn btn-default engaged" aria-pressed="true" data-action="a" id="id_1">A</button>
441  <button class="btn btn-default" aria-pressed="false" data-action="b" id="id_2">B</button>
442  </div>
443  </div>
444  <div class="panel-controls"></div>
445  </div>
446  <div class="panel-body"></div>
447 </div>
448 EOT;
449  $this->assertEquals(
450  $this->brutallyTrimHTML($expected_html),
451  $this->brutallyTrimHTML($html)
452  );
453  }
button(string $caption, string $cmd)
Title class.
Definition: Title.php:41
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21
getPanelFactory()
Definition: PanelTest.php:77
getUIFactory()
Definition: PanelTest.php:47
$r
+ Here is the call graph for this function:

◆ testRenderStandard()

PanelTest::testRenderStandard ( )

Definition at line 214 of file PanelTest.php.

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

214  : void
215  {
216  $f = $this->getPanelFactory();
217  $r = $this->getDefaultRenderer();
218 
219  $actions = new I\Component\Dropdown\Standard(array(
220  new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
221  new I\Component\Button\Shy("GitHub", "https://www.github.com")
222  ));
223 
224  $p = $f->standard("Title", array())->withActions($actions);
225 
226  $html = $r->render($p);
227 
228  $expected_html = <<<EOT
229 <div class="panel panel-primary panel-flex">
230  <div class="panel-heading ilHeader">
231  <div class="panel-title"><h2>Title</h2></div>
232  <div class="panel-controls">
233  <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>
234  <ul id="id_3_menu" class="dropdown-menu">
235  <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
236  <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button></li>
237  </ul>
238  </div>
239  </div>
240  </div>
241  <div class="panel-body"></div>
242 </div>
243 EOT;
244  $this->assertHTMLEquals($expected_html, $html);
245  }
button(string $caption, string $cmd)
Interface Observer Contains several chained tasks and infos about them.
Title class.
Definition: Title.php:41
getPanelFactory()
Definition: PanelTest.php:77
$r
+ Here is the call graph for this function:

◆ testRenderSub()

PanelTest::testRenderSub ( )

Definition at line 247 of file PanelTest.php.

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

247  : void
248  {
249  $fp = $this->getPanelFactory();
250  $r = $this->getDefaultRenderer();
251 
252  $actions = new I\Component\Dropdown\Standard(array(
253  new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
254  new I\Component\Button\Shy("GitHub", "https://www.github.com")
255  ));
256 
257  $p = $fp->sub("Title", array())->withActions($actions);
258  $card = new I\Component\Card\Card("Card Title");
259 
260  $p = $p->withFurtherInformation($card);
261  $html = $this->brutallyTrimHTML($r->render($p));
262 
263  $expected_html = <<<EOT
264 <div class="panel panel-sub panel-flex">
265  <div class="panel-heading ilBlockHeader">
266  <h3>Title</h3>
267  <div class="panel-controls">
268  <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>
269  <ul id="id_3_menu" class="dropdown-menu">
270  <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
271  <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button></li>
272  </ul>
273  </div>
274  </div>
275  </div>
276  <div class="panel-body">
277  <div class="row">
278  <div class="col-sm-8"></div>
279  <div class="col-sm-4">
280  <div class="il-card thumbnail">
281  <div class="card-no-highlight"></div>
282  <div class="caption card-title">Card Title</div>
283  </div>
284  </div>
285  </div>
286  </div>
287 </div>
288 EOT;
289 
290  $this->assertHTMLEquals($this->brutallyTrimHTML($expected_html), $html);
291  }
button(string $caption, string $cmd)
Interface Observer Contains several chained tasks and infos about them.
Title class.
Definition: Title.php:41
getPanelFactory()
Definition: PanelTest.php:77
$r
+ Here is the call graph for this function:

◆ testRenderSubWithSecondaryPanel()

PanelTest::testRenderSubWithSecondaryPanel ( )

Definition at line 293 of file PanelTest.php.

References $r.

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

◆ testRenderWithPagination()

PanelTest::testRenderWithPagination ( )

Definition at line 500 of file PanelTest.php.

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

500  : void
501  {
502  $pagination = $this->getUIFactory()->viewControl()->pagination()
503  ->withTargetURL('http://ilias.de', 'page')
504  ->withTotalEntries(10)
505  ->withPageSize(2)
506  ->withCurrentPage(1);
507 
508  $f = $this->getPanelFactory();
509  $r = $this->getDefaultRenderer();
510 
511 
512  $p = $f->standard("Title", [])
513  ->withViewControls([$pagination]);
514 
515  $html = $r->render($p);
516 
517  $expected_html = <<<EOT
518 <div class="panel panel-primary panel-flex">
519  <div class="panel-heading ilHeader">
520  <div class="panel-title"><h2>Title</h2></div>
521  <div class="panel-viewcontrols l-bar__space-keeper">
522  <div class="il-viewcontrol-pagination l-bar__element">
523  <span class="btn btn-ctrl browse previous">
524  <a tabindex="0" class="glyph" href="http://ilias.de?page=0" aria-label="back">
525  <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
526  </a>
527  </span>
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  <span class="btn btn-ctrl browse next">
534  <a tabindex="0" class="glyph" href="http://ilias.de?page=2" aria-label="next">
535  <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
536  </a>
537  </span>
538  </div>
539  </div>
540  <div class="panel-controls"></div>
541  </div>
542  <div class="panel-body"></div>
543 </div>
544 EOT;
545  $this->assertEquals(
546  $this->brutallyTrimHTML($expected_html),
547  $this->brutallyTrimHTML($html)
548  );
549  }
button(string $caption, string $cmd)
Title class.
Definition: Title.php:41
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 455 of file PanelTest.php.

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

455  : void
456  {
457  $sort_options = [
458  'a' => 'A',
459  'b' => 'B'
460  ];
461 
462  $sortation = $this->getUIFactory()->viewControl()->sortation($sort_options, 'b');
463 
464  $f = $this->getPanelFactory();
465  $r = $this->getDefaultRenderer();
466 
467 
468  $p = $f->standard("Title", [])
469  ->withViewControls([$sortation]);
470 
471  $html = $r->render($p);
472 
473  $expected_html = <<<EOT
474 <div class="panel panel-primary panel-flex">
475  <div class="panel-heading ilHeader">
476  <div class="panel-title"><h2>Title</h2></div>
477  <div class="panel-viewcontrols l-bar__space-keeper">
478  <div class="dropdown il-viewcontrol il-viewcontrol-sortation l-bar__element" id="id_1">
479  <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">
480  <span class="label">vc_sort B</span>
481  <span class="glyphicon-sort"></span>
482  </button>
483  <ul id="id_1_ctrl" class="dropdown-menu">
484  <li><button class="btn btn-link" data-action="?sortation=a" id="id_2">A</button></li>
485  <li class="selected"><button class="btn btn-link" data-action="?sortation=b" id="id_3">B</button></li>
486  </ul>
487  </div>
488  </div>
489  <div class="panel-controls"></div>
490  </div>
491  <div class="panel-body"></div>
492 </div>
493 EOT;
494  $this->assertEquals(
495  $this->brutallyTrimHTML($expected_html),
496  $this->brutallyTrimHTML($html)
497  );
498  }
button(string $caption, string $cmd)
Title class.
Definition: Title.php:41
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21
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 205 of file PanelTest.php.

References Vendor\Package\$f.

205  : void
206  {
207  $f = $this->getPanelFactory();
208  $sub = $f->sub("Title", array(new ComponentDummy()));
209  $p = $f->report("Title", [$sub]);
210 
211  $this->assertEquals($p->getContent(), array($sub));
212  }
getPanelFactory()
Definition: PanelTest.php:77

◆ testReportGetTitle()

PanelTest::testReportGetTitle ( )

Definition at line 196 of file PanelTest.php.

References Vendor\Package\$f.

196  : void
197  {
198  $f = $this->getPanelFactory();
199  $sub = $f->sub("Title", array(new ComponentDummy()));
200  $p = $f->report("Title", array($sub));
201 
202  $this->assertEquals("Title", $p->getTitle());
203  }
getPanelFactory()
Definition: PanelTest.php:77

◆ testReportWithActions()

PanelTest::testReportWithActions ( )

Definition at line 180 of file PanelTest.php.

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

◆ testReportWithViewControls()

PanelTest::testReportWithViewControls ( )

Definition at line 402 of file PanelTest.php.

References Vendor\Package\$f.

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

◆ testStandardGetContent()

PanelTest::testStandardGetContent ( )

Definition at line 112 of file PanelTest.php.

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

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

◆ testStandardGetTitle()

PanelTest::testStandardGetTitle ( )

Definition at line 104 of file PanelTest.php.

References Vendor\Package\$f.

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

◆ testStandardWithActions()

PanelTest::testStandardWithActions ( )

Definition at line 121 of file PanelTest.php.

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

◆ testStandardWithViewControls()

PanelTest::testStandardWithViewControls ( )

Definition at line 387 of file PanelTest.php.

References Vendor\Package\$f.

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

◆ testSubWithActions()

PanelTest::testSubWithActions ( )

Definition at line 137 of file PanelTest.php.

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

◆ testSubWithCard()

PanelTest::testSubWithCard ( )

Definition at line 153 of file PanelTest.php.

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

◆ testSubWithSecondaryPanel()

PanelTest::testSubWithSecondaryPanel ( )

Definition at line 166 of file PanelTest.php.

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

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