ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ItemTest Class Reference

Test items. More...

+ Inheritance diagram for ItemTest:
+ Collaboration diagram for ItemTest:

Public Member Functions

 getFactory ()
 
 test_implements_factory_interface ()
 
 test_get_title ()
 
 test_with_description ()
 
 test_with_properties ()
 
 test_with_progress ()
 
 test_with_actions ()
 
 test_with_color ()
 
 test_with_lead_image ()
 
 test_with_lead_icon ()
 
 test_with_lead_letter_avatar ()
 
 test_with_lead_picture_avatar ()
 
 test_with_lead_text ()
 
 test_with_no_lead ()
 
 test_with_audio_player ()
 
 test_render_base ()
 
 test_render_lead_image ()
 
 test_render_lead_icon ()
 
 test_render_lead_letter_avatar ()
 
 test_render_lead_picture_avatar ()
 
 test_render_progress ()
 
 test_render_progress_and_lead_image ()
 
 test_render_progress_and_lead_icon ()
 
 test_render_lead_text_and_color ()
 
 test_shy_title_and_various_properties ()
 
 test_link_title ()
 
 test_render_audio_player ()
 
- 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 items.

Definition at line 33 of file ItemTest.php.

Member Function Documentation

◆ getFactory()

◆ test_get_title()

ItemTest::test_get_title ( )

Definition at line 47 of file ItemTest.php.

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

47  : void
48  {
49  $f = $this->getFactory();
50  $c = $f->standard("title");
51 
52  $this->assertEquals("title", $c->getTitle());
53  }
$c
Definition: cli.php:38
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ test_implements_factory_interface()

ItemTest::test_implements_factory_interface ( )

Definition at line 40 of file ItemTest.php.

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

40  : void
41  {
42  $f = $this->getFactory();
43 
44  $this->assertInstanceOf("ILIAS\\UI\\Component\\Item\\Standard", $f->standard("title"));
45  }
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ test_link_title()

ItemTest::test_link_title ( )

Definition at line 577 of file ItemTest.php.

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

577  : void
578  {
579  $f = $this->getFactory();
580  $r = $this->getDefaultRenderer();
581 
582  $c = $f->standard(new I\Component\Link\Standard("ILIAS", "https://www.ilias.de"));
583  $html = $r->render($c);
584 
585  $expected = <<<EOT
586 <div class="il-item il-std-item "><div class="il-item-title"><a href="https://www.ilias.de">ILIAS</a></div></div>
587 EOT;
588 
589  $this->assertHTMLEquals($expected, $html);
590  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
$c
Definition: cli.php:38
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...
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ test_render_audio_player()

ItemTest::test_render_audio_player ( )

Definition at line 592 of file ItemTest.php.

References $c, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

592  : void
593  {
594  $f = $this->getFactory();
595  $r = $this->getDefaultRenderer();
596 
597  $audio = new I\Component\Player\Audio("src", "");
598  $c = $f->standard("title")->withAudioPlayer($audio);
599 
600  $html = $r->render($c);
601  $expected = <<<EOT
602 <div class="il-item il-std-item ">
603  <div class="il-item-title">title</div>
604  <div class="il-item-audio"><div class="il-audio-container">
605  <audio class="il-audio-player" id="id_1" src="src" preload="metadata"></audio>
606 </div></div>
607 </div>
608 EOT;
609  $this->assertHTMLEquals(
610  $this->brutallyTrimHTML($expected),
611  $this->brutallyTrimHTML($html)
612  );
613  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
$c
Definition: cli.php:38
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ test_render_base()

ItemTest::test_render_base ( )

Definition at line 181 of file ItemTest.php.

References $c, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

181  : void
182  {
183  $f = $this->getFactory();
184  $r = $this->getDefaultRenderer();
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  $c = $f->standard("Item Title")
191  ->withActions($actions)
192  ->withProperties(array(
193  "Origin" => "Course Title 1",
194  "Last Update" => "24.11.2011",
195  "Location" => "Room 123, Main Street 44, 3012 Bern"))
196  ->withDescription("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.");
197 
198  $html = $r->render($c);
199 
200  $expected = <<<EOT
201  <div class="il-item il-std-item ">
202  <div class="il-item-title">Item Title</div>
203  <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>
204  <ul id="id_3_menu" class="dropdown-menu">
205  <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1" >ILIAS</button>
206  </li>
207  <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2" >GitHub</button>
208  </li>
209  </ul>
210  </div>
211  <div class="il-item-description">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</div>
212  <hr class="il-item-divider" />
213  <div class="row">
214  <div class="col-md-6 il-multi-line-cap-3">
215  <span class="il-item-property-name">Origin</span><span class="il-item-property-value">Course Title 1</span>
216  </div>
217  <div class="col-md-6 il-multi-line-cap-3">
218  <span class="il-item-property-name">Last Update</span><span class="il-item-property-value">24.11.2011</span>
219  </div>
220  </div>
221  <div class="row">
222  <div class="col-md-6 il-multi-line-cap-3">
223  <span class="il-item-property-name">Location</span><span class="il-item-property-value">Room 123, Main Street 44, 3012 Bern</span>
224  </div>
225  <div class="col-md-6 il-multi-line-cap-3">
226  <span class="il-item-property-name"></span><span class="il-item-property-value"></span>
227  </div>
228  </div>
229  </div>
230 EOT;
231 
232  $this->assertHTMLEquals(
233  $this->brutallyTrimHTML($expected),
234  $this->brutallyTrimHTML($html)
235  );
236  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
$c
Definition: cli.php:38
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
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:444
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ test_render_lead_icon()

ItemTest::test_render_lead_icon ( )

Definition at line 267 of file ItemTest.php.

References $c, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

267  : void
268  {
269  $f = $this->getFactory();
270  $r = $this->getDefaultRenderer();
271 
272  $icon = new I\Component\Symbol\Icon\Standard("name", "aria_label", "small", false);
273 
274  $c = $f->standard("title")->withLeadIcon($icon);
275 
276  $html = $r->render($c);
277  $expected = <<<EOT
278 <div class="il-item il-std-item ">
279  <div class="media">
280  <div class="media-left">
281  <img class="icon name small" src="./templates/default/images/icon_default.svg" alt="aria_label" />
282  </div>
283  <div class="media-body">
284  <div class="il-item-title">title</div>
285  </div>
286  </div>
287 </div>
288 EOT;
289 
290  $this->assertHTMLEquals(
291  $this->brutallyTrimHTML($expected),
292  $this->brutallyTrimHTML($html)
293  );
294  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
$c
Definition: cli.php:38
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ test_render_lead_image()

ItemTest::test_render_lead_image ( )

Definition at line 238 of file ItemTest.php.

References $c, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

238  : void
239  {
240  $f = $this->getFactory();
241  $r = $this->getDefaultRenderer();
242 
243  $image = new I\Component\Image\Image("standard", "src", "str");
244 
245  $c = $f->standard("title")->withLeadImage($image);
246 
247  $html = $r->render($c);
248  $expected = <<<EOT
249 <div class="il-item il-std-item ">
250  <div class="row">
251  <div class="col-xs-2 col-sm-3">
252  <img src="src" class="img-standard" alt="str" />
253  </div>
254  <div class="col-xs-10 col-sm-9">
255  <div class="il-item-title">title</div>
256  </div>
257  </div>
258 </div>
259 EOT;
260 
261  $this->assertHTMLEquals(
262  $this->brutallyTrimHTML($expected),
263  $this->brutallyTrimHTML($html)
264  );
265  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
$c
Definition: cli.php:38
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ test_render_lead_letter_avatar()

ItemTest::test_render_lead_letter_avatar ( )

Definition at line 296 of file ItemTest.php.

References $c, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

296  : void
297  {
298  $f = $this->getFactory();
299  $r = $this->getDefaultRenderer();
300 
301  $avatar = new Letter('il');
302 
303  $c = $f->standard("title")->withLeadAvatar($avatar);
304 
305  $html = $r->render($c);
306 
307  $expected = <<<EOT
308 <div class="il-item il-std-item ">
309  <div class="media">
310  <div class="media-left">
311  <span class="il-avatar il-avatar-letter il-avatar-size-large il-avatar-letter-color-11" aria-label="user_avatar" role="img">
312  <span class="abbreviation">il</span>
313  </span>
314  </div>
315  <div class="media-body">
316  <div class="il-item-title">title</div>
317  </div>
318  </div>
319 </div>
320 EOT;
321 
322  $this->assertHTMLEquals(
323  $this->brutallyTrimHTML($expected),
324  $this->brutallyTrimHTML($html)
325  );
326  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
$c
Definition: cli.php:38
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ test_render_lead_picture_avatar()

ItemTest::test_render_lead_picture_avatar ( )

Definition at line 328 of file ItemTest.php.

References $c, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

328  : void
329  {
330  $f = $this->getFactory();
331  $r = $this->getDefaultRenderer();
332 
333  $avatar = new Picture('./templates/default/images/no_photo_xsmall.jpg', 'demo.user');
334 
335  $c = $f->standard("title")->withLeadAvatar($avatar);
336 
337  $html = $r->render($c);
338  $expected = <<<EOT
339 <div class="il-item il-std-item ">
340  <div class="media">
341  <div class="media-left">
342  <span class="il-avatar il-avatar-picture il-avatar-size-large">
343  <img src="./templates/default/images/no_photo_xsmall.jpg" alt="user_avatar"/>
344  </span>
345  </div>
346  <div class="media-body">
347  <div class="il-item-title">title</div>
348  </div>
349  </div>
350 </div>
351 EOT;
352 
353  $this->assertHTMLEquals(
354  $this->brutallyTrimHTML($expected),
355  $this->brutallyTrimHTML($html)
356  );
357  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
$c
Definition: cli.php:38
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ test_render_lead_text_and_color()

ItemTest::test_render_lead_text_and_color ( )

Definition at line 511 of file ItemTest.php.

References $c, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

511  : void
512  {
513  $f = $this->getFactory();
514  $r = $this->getDefaultRenderer();
515  $df = new Data\Factory();
516 
517  $color = $df->color('#ff00ff');
518 
519  $c = $f->standard("title")->withColor($color)->withLeadText("lead");
520 
521  $html = $r->render($c);
522 
523  $expected = <<<EOT
524 <div class="il-item il-std-item il-item-marker " style="border-color:#ff00ff">
525  <div class="row">
526  <div class="col-sm-3">
527  lead
528  </div>
529  <div class="col-sm-9">
530  <div class="il-item-title">title</div>
531  </div>
532  </div>
533 </div>
534 EOT;
535 
536  $this->assertHTMLEquals(
537  $this->brutallyTrimHTML($expected),
538  $this->brutallyTrimHTML($html)
539  );
540  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
$c
Definition: cli.php:38
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ test_render_progress()

ItemTest::test_render_progress ( )

Definition at line 359 of file ItemTest.php.

References $c, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

359  : void
360  {
361  $f = $this->getFactory();
362  $r = $this->getDefaultRenderer();
363 
364  $chart = new I\Component\Chart\ProgressMeter\Standard(100, 75);
365 
366  $c = $f->standard("title")->withProgress($chart);
367 
368  $html = $r->render($c);
369  $expected = <<<EOT
370 <div class="il-item il-std-item ">
371  <div class="row">
372  <div class="col-sm-9">
373  <div class="il-item-title">title</div>
374  </div>
375  <div class="col-xs-3 col-sm-2 col-lg-2">
376  <div class="il-chart-progressmeter-box ">
377  <div class="il-chart-progressmeter-container">
378  <svg viewBox="0 0 50 40" class="il-chart-progressmeter-viewbox">
379  <path class="il-chart-progressmeter-circle-bg" stroke-dasharray="100, 100" d="M10.4646,37.0354 q-5.858,-5.858 -5.858,-14.142 a1,1 0 1,1 40,0 q0,8.284 -5.858,14.142"></path>
380  <g class="il-chart-progressmeter-monocircle">
381  <path class="il-chart-progressmeter-circle no-success" stroke-dasharray="75, 100" d="M10.4646,37.0354 q-5.858,-5.858 -5.858,-14.142 a1,1 0 1,1 40,0 q0,8.284 -5.858,14.142"></path>
382  </g>
383  <g class="il-chart-progressmeter-text">
384  <text class="text-score-info" x="25" y="16"></text>
385  <text class="text-score" x="25" y="25">75 %</text>
386  <text class="text-comparision" x="25" y="31"></text>
387  <text class="text-comparision-info" x="25" y="34"></text>
388  </g>
389  <g class="il-chart-progressmeter-needle no-needle" style="transform: rotate(deg)">
390  <polygon class="il-chart-progressmeter-needle-border" points="23.5,0.1 25,2.3 26.5,0.1"></polygon>
391  <polygon class="il-chart-progressmeter-needle-fill" points="23.5,0 25,2.2 26.5,0"></polygon>
392  </g>
393  </svg>
394  </div>
395  </div>
396  </div>
397  </div>
398 </div>
399 EOT;
400 
401  $this->assertHTMLEquals(
402  $this->brutallyTrimHTML($expected),
403  $this->brutallyTrimHTML($html)
404  );
405  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
$c
Definition: cli.php:38
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ test_render_progress_and_lead_icon()

ItemTest::test_render_progress_and_lead_icon ( )

Definition at line 459 of file ItemTest.php.

References $c, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

459  : void
460  {
461  $f = $this->getFactory();
462  $r = $this->getDefaultRenderer();
463 
464  $icon = new I\Component\Symbol\Icon\Standard("name", "aria_label", "small", false);
465  $chart = new I\Component\Chart\ProgressMeter\Standard(100, 75);
466 
467  $c = $f->standard("title")->withLeadIcon($icon)->withProgress($chart);
468 
469  $html = $r->render($c);
470  $expected = <<<EOT
471 <div class="il-item il-std-item ">
472  <div class="media">
473  <div class="media-left">
474  <img class="icon name small" src="./templates/default/images/icon_default.svg" alt="aria_label" />
475  </div>
476  <div class="media-body">
477  <div class="il-item-title">title</div>
478  </div>
479  <div class="media-right">
480  <div class="il-chart-progressmeter-box ">
481  <div class="il-chart-progressmeter-container">
482  <svg viewBox="0 0 50 40" class="il-chart-progressmeter-viewbox">
483  <path class="il-chart-progressmeter-circle-bg" stroke-dasharray="100, 100" d="M10.4646,37.0354 q-5.858,-5.858 -5.858,-14.142 a1,1 0 1,1 40,0 q0,8.284 -5.858,14.142"></path>
484  <g class="il-chart-progressmeter-monocircle">
485  <path class="il-chart-progressmeter-circle no-success" stroke-dasharray="75, 100" d="M10.4646,37.0354 q-5.858,-5.858 -5.858,-14.142 a1,1 0 1,1 40,0 q0,8.284 -5.858,14.142"></path>
486  </g>
487  <g class="il-chart-progressmeter-text">
488  <text class="text-score-info" x="25" y="16"></text>
489  <text class="text-score" x="25" y="25">75 %</text>
490  <text class="text-comparision" x="25" y="31"></text>
491  <text class="text-comparision-info" x="25" y="34"></text>
492  </g>
493  <g class="il-chart-progressmeter-needle no-needle" style="transform: rotate(deg)">
494  <polygon class="il-chart-progressmeter-needle-border" points="23.5,0.1 25,2.3 26.5,0.1"></polygon>
495  <polygon class="il-chart-progressmeter-needle-fill" points="23.5,0 25,2.2 26.5,0"></polygon>
496  </g>
497  </svg>
498  </div>
499  </div>
500  </div>
501  </div>
502 </div>
503 EOT;
504 
505  $this->assertHTMLEquals(
506  $this->brutallyTrimHTML($expected),
507  $this->brutallyTrimHTML($html)
508  );
509  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
$c
Definition: cli.php:38
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ test_render_progress_and_lead_image()

ItemTest::test_render_progress_and_lead_image ( )

Definition at line 407 of file ItemTest.php.

References $c, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

407  : void
408  {
409  $f = $this->getFactory();
410  $r = $this->getDefaultRenderer();
411 
412  $image = new I\Component\Image\Image("standard", "src", "str");
413  $chart = new I\Component\Chart\ProgressMeter\Standard(100, 75);
414 
415  $c = $f->standard("title")->withLeadImage($image)->withProgress($chart);
416 
417  $html = $r->render($c);
418  $expected = <<<EOT
419 <div class="il-item il-std-item ">
420  <div class="row">
421  <div class="col-xs-3 col-sm-3 col-lg-2">
422  <img src="src" class="img-standard" alt="str" />
423  </div>
424  <div class="col-xs-6 col-sm-7 col-lg-8">
425  <div class="il-item-title">title</div>
426  </div>
427  <div class="col-xs-3 col-sm-2 col-lg-2">
428  <div class="il-chart-progressmeter-box ">
429  <div class="il-chart-progressmeter-container">
430  <svg viewBox="0 0 50 40" class="il-chart-progressmeter-viewbox">
431  <path class="il-chart-progressmeter-circle-bg" stroke-dasharray="100, 100" d="M10.4646,37.0354 q-5.858,-5.858 -5.858,-14.142 a1,1 0 1,1 40,0 q0,8.284 -5.858,14.142"></path>
432  <g class="il-chart-progressmeter-monocircle">
433  <path class="il-chart-progressmeter-circle no-success" stroke-dasharray="75, 100" d="M10.4646,37.0354 q-5.858,-5.858 -5.858,-14.142 a1,1 0 1,1 40,0 q0,8.284 -5.858,14.142"></path>
434  </g>
435  <g class="il-chart-progressmeter-text">
436  <text class="text-score-info" x="25" y="16"></text>
437  <text class="text-score" x="25" y="25">75 %</text>
438  <text class="text-comparision" x="25" y="31"></text>
439  <text class="text-comparision-info" x="25" y="34"></text>
440  </g>
441  <g class="il-chart-progressmeter-needle no-needle" style="transform: rotate(deg)">
442  <polygon class="il-chart-progressmeter-needle-border" points="23.5,0.1 25,2.3 26.5,0.1"></polygon>
443  <polygon class="il-chart-progressmeter-needle-fill" points="23.5,0 25,2.2 26.5,0"></polygon>
444  </g>
445  </svg>
446  </div>
447  </div>
448  </div>
449  </div>
450 </div>
451 EOT;
452 
453  $this->assertHTMLEquals(
454  $this->brutallyTrimHTML($expected),
455  $this->brutallyTrimHTML($html)
456  );
457  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
$c
Definition: cli.php:38
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ test_shy_title_and_various_properties()

ItemTest::test_shy_title_and_various_properties ( )

Definition at line 542 of file ItemTest.php.

References $c, Vendor\Package\$f, ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

542  : void
543  {
544  $f = $this->getFactory();
545  $r = $this->getDefaultRenderer();
546  $df = new Data\Factory();
547 
548  $df->color('#ff00ff');
549 
550  $c = $f->standard(new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"))
551  ->withProperties([
552  "Property Text" => "Text",
553  "Property HTML" => "<a>Link</a>",
554  "Property Shy" => new I\Component\Button\Shy("GitHub", "https://www.github.com"),
555  "Property Icon" => new I\Component\Symbol\Icon\Standard("name", "aria_label", "small", false)
556  ]);
557 
558  $html = $this->brutallyTrimHTML($r->render($c));
559  $expected = $this->brutallyTrimHTML(<<<EOT
560 <div class="il-item il-std-item ">
561  <div class="il-item-title"><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></div>
562  <hr class="il-item-divider" />
563  <div class="row">
564  <div class="col-md-6 il-multi-line-cap-3"><span class="il-item-property-name">Property Text</span><span class="il-item-property-value">Text</span></div>
565  <div class="col-md-6 il-multi-line-cap-3"><span class="il-item-property-name">Property HTML</span><span class="il-item-property-value"><a>Link</a></span></div>
566  </div>
567  <div class="row">
568  <div class="col-md-6 il-multi-line-cap-3"><span class="il-item-property-name">Property Shy</span><span class="il-item-property-value"><button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button></span></div>
569  <div class="col-md-6 il-multi-line-cap-3"><span class="il-item-property-name">Property Icon</span><span class="il-item-property-value"><img class="icon name small" src="./templates/default/images/icon_default.svg" alt="aria_label"/></span></div>
570  </div>
571 </div>
572 EOT);
573 
574  $this->assertEquals($expected, $html);
575  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
$c
Definition: cli.php:38
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...
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:444
ILIAS base class perform basic setup: init database handler, load configuration file, init user authentification & error handler, load object type definitions.
Definition: class.ilias.php:14
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ test_with_actions()

ItemTest::test_with_actions ( )

Definition at line 84 of file ItemTest.php.

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

84  : void
85  {
86  $f = $this->getFactory();
87 
88  $actions = new I\Component\Dropdown\Standard(array(
89  new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
90  new I\Component\Button\Shy("GitHub", "https://www.github.com")
91  ));
92  $c = $f->standard("title")->withActions($actions);
93 
94  $this->assertEquals($c->getActions(), $actions);
95  }
$c
Definition: cli.php:38
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ test_with_audio_player()

ItemTest::test_with_audio_player ( )

Definition at line 171 of file ItemTest.php.

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

171  : void
172  {
173  $f = $this->getFactory();
174 
175  $audio = new I\Component\Player\Audio("src", "transcript");
176  $c = $f->standard("title")->withAudioPlayer($audio);
177 
178  $this->assertEquals($c->getAudioPlayer(), $audio);
179  }
$c
Definition: cli.php:38
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ test_with_color()

ItemTest::test_with_color ( )

Definition at line 97 of file ItemTest.php.

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

97  : void
98  {
99  $f = $this->getFactory();
100  $df = new Data\Factory();
101 
102  $color = $df->color('#ff00ff');
103 
104  $c = $f->standard("title")->withColor($color);
105 
106  $this->assertEquals($c->getColor(), $color);
107  }
$c
Definition: cli.php:38
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ test_with_description()

ItemTest::test_with_description ( )

Definition at line 55 of file ItemTest.php.

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

55  : void
56  {
57  $f = $this->getFactory();
58 
59  $c = $f->standard("title")->withDescription("description");
60 
61  $this->assertEquals("description", $c->getDescription());
62  }
$c
Definition: cli.php:38
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ test_with_lead_icon()

ItemTest::test_with_lead_icon ( )

Definition at line 120 of file ItemTest.php.

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

120  : void
121  {
122  $f = $this->getFactory();
123 
124  $icon = new I\Component\Symbol\Icon\Standard("name", "aria_label", "small", false);
125 
126  $c = $f->standard("title")->withLeadIcon($icon);
127 
128  $this->assertEquals($icon, $c->getLead());
129  }
$c
Definition: cli.php:38
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ test_with_lead_image()

ItemTest::test_with_lead_image ( )

Definition at line 109 of file ItemTest.php.

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

109  : void
110  {
111  $f = $this->getFactory();
112 
113  $image = new I\Component\Image\Image("standard", "src", "str");
114 
115  $c = $f->standard("title")->withLeadImage($image);
116 
117  $this->assertEquals($c->getLead(), $image);
118  }
$c
Definition: cli.php:38
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ test_with_lead_letter_avatar()

ItemTest::test_with_lead_letter_avatar ( )

Definition at line 131 of file ItemTest.php.

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

131  : void
132  {
133  $f = $this->getFactory();
134 
135  $avatar = new Letter('il');
136 
137  $c = $f->standard("title")->withLeadAvatar($avatar);
138 
139  $this->assertEquals($avatar, $c->getLead());
140  }
$c
Definition: cli.php:38
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ test_with_lead_picture_avatar()

ItemTest::test_with_lead_picture_avatar ( )

Definition at line 142 of file ItemTest.php.

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

142  : void
143  {
144  $f = $this->getFactory();
145 
146  $avatar = new Picture('./templates/default/images/no_photo_xsmall.jpg', 'demo.user');
147 
148  $c = $f->standard("title")->withLeadAvatar($avatar);
149 
150  $this->assertEquals($avatar, $c->getLead());
151  }
$c
Definition: cli.php:38
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ test_with_lead_text()

ItemTest::test_with_lead_text ( )

Definition at line 153 of file ItemTest.php.

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

153  : void
154  {
155  $f = $this->getFactory();
156 
157  $c = $f->standard("title")->withLeadText("text");
158 
159  $this->assertEquals("text", $c->getLead());
160  }
$c
Definition: cli.php:38
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ test_with_no_lead()

ItemTest::test_with_no_lead ( )

Definition at line 162 of file ItemTest.php.

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

162  : void
163  {
164  $f = $this->getFactory();
165 
166  $c = $f->standard("title")->withLeadText("text")->withNoLead();
167 
168  $this->assertEquals(null, $c->getLead());
169  }
$c
Definition: cli.php:38
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ test_with_progress()

ItemTest::test_with_progress ( )

Definition at line 74 of file ItemTest.php.

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

74  : void
75  {
76  $f = $this->getFactory();
77  $chart = new I\Component\Chart\ProgressMeter\ProgressMeter(100, 50);
78 
79  $c = $f->standard("title")->withProgress($chart);
80 
81  $this->assertEquals($c->getProgress(), $chart);
82  }
$c
Definition: cli.php:38
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ test_with_properties()

ItemTest::test_with_properties ( )

Definition at line 64 of file ItemTest.php.

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

64  : void
65  {
66  $f = $this->getFactory();
67 
68  $props = array("prop1" => "val1", "prop2" => "val2");
69  $c = $f->standard("title")->withProperties($props);
70 
71  $this->assertEquals($c->getProperties(), $props);
72  }
$c
Definition: cli.php:38
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

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