ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ItemTest Class Reference

Test items. More...

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

Public Member Functions

 getFactory ()
 
 testImplementsFactoryInterface ()
 
 testGetTitle ()
 
 testWithDescription ()
 
 testWithProperties ()
 
 testWithProgress ()
 
 testWithActions ()
 
 testWithColor ()
 
 testWithLeadImage ()
 
 testWithLeadIcon ()
 
 testWithLeadLetterAvatar ()
 
 testWithLeadPictureAvatar ()
 
 testWithLeadText ()
 
 testWithNoLead ()
 
 testWithAudioPlayer ()
 
 testWithMainActionButton ()
 
 testWithMainActionLink ()
 
 testRenderBase ()
 
 testRenderLeadImage ()
 
 testRenderLeadIcon ()
 
 testRenderLeadLetterAvatar ()
 
 testRenderLeadPictureAvatar ()
 
 testRenderProgress ()
 
 testRenderProgressAndLeadImage ()
 
 testRenderProgressAndLeadIcon ()
 
 testRenderLeadTextAndColor ()
 
 testShyTitleAndVariousProperties ()
 
 testLinkTitle ()
 
 testRenderAudioPlayer ()
 
 testMainActionButton ()
 
 testMainActionLink ()
 

Detailed Description

Test items.

Definition at line 33 of file ItemTest.php.

Member Function Documentation

◆ getFactory()

◆ testGetTitle()

ItemTest::testGetTitle ( )

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: deliver.php:25
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ testImplementsFactoryInterface()

ItemTest::testImplementsFactoryInterface ( )

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:

◆ testLinkTitle()

ItemTest::testLinkTitle ( )

Definition at line 617 of file ItemTest.php.

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

617  : void
618  {
619  $f = $this->getFactory();
620  $r = $this->getDefaultRenderer();
621 
622  $c = $f->standard(new I\Component\Link\Standard("ILIAS", "https://www.ilias.de"));
623  $html = $r->render($c);
624 
625  $expected = <<<EOT
626 <div class="il-item il-std-item "><h4 class="il-item-title"><a href="https://www.ilias.de">ILIAS</a></h4></div>
627 EOT;
628 
629  $this->assertHTMLEquals($expected, $html);
630  }
Interface Observer Contains several chained tasks and infos about them.
$c
Definition: deliver.php:25
getFactory()
Definition: ItemTest.php:35
$r
+ Here is the call graph for this function:

◆ testMainActionButton()

ItemTest::testMainActionButton ( )

Definition at line 655 of file ItemTest.php.

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

655  : void
656  {
657  $f = $this->getFactory();
658 
659  $expected_button_html = md5(I\Component\Button\Standard::class);
660  $main_action = $this->createMock(I\Component\Button\Standard::class);
661  $main_action->method('getCanonicalName')->willReturn($expected_button_html);
662 
663  $c = $f->standard("Title")->withMainAction($main_action);
664 
665  $html = $this->getDefaultRenderer(null, [
666  $main_action
667  ])->render($c);
668 
669  $expected = <<<EOT
670  <div class="il-item il-std-item ">
671  <h4 class="il-item-title">Title</h4>
672  <div class="il-item-actions l-bar__space-keeper">
673  <div class="l-bar__element">$expected_button_html
674  </div>
675  </div>
676  </div>
677 EOT;
678 
679  $this->assertHTMLEquals(
680  $this->brutallyTrimHTML($expected),
681  $this->brutallyTrimHTML($html)
682  );
683  }
Title class.
Definition: Title.php:41
$c
Definition: deliver.php:25
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ testMainActionLink()

ItemTest::testMainActionLink ( )

Definition at line 685 of file ItemTest.php.

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

685  : void
686  {
687  $f = $this->getFactory();
688  $expected_link_html = md5(I\Component\Link\Standard::class);
689  $main_action = $this->createMock(I\Component\Link\Standard::class);
690  $main_action->method('getCanonicalName')->willReturn($expected_link_html);
691 
692  $c = $f->standard("Title")->withMainAction($main_action);
693 
694  $html = $this->getDefaultRenderer(null, [
695  $main_action
696  ])->render($c);
697 
698  $expected = <<<EOT
699  <div class="il-item il-std-item ">
700  <h4 class="il-item-title">Title</h4>
701  <div class="il-item-actions l-bar__space-keeper">
702  <div class="l-bar__element">$expected_link_html</div>
703  </div>
704  </div>
705 EOT;
706 
707  $this->assertHTMLEquals(
708  $this->brutallyTrimHTML($expected),
709  $this->brutallyTrimHTML($html)
710  );
711  }
Title class.
Definition: Title.php:41
$c
Definition: deliver.php:25
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ testRenderAudioPlayer()

ItemTest::testRenderAudioPlayer ( )

Definition at line 632 of file ItemTest.php.

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

632  : void
633  {
634  $f = $this->getFactory();
635  $r = $this->getDefaultRenderer();
636 
637  $audio = new I\Component\Player\Audio("src", "");
638  $c = $f->standard("title")->withAudioPlayer($audio);
639 
640  $html = $r->render($c);
641  $expected = <<<EOT
642 <div class="il-item il-std-item ">
643  <h4 class="il-item-title">title</h4>
644  <div class="il-item-audio"><div class="il-audio-container">
645  <audio class="il-audio-player" id="id_1" src="src" preload="metadata"></audio>
646 </div></div>
647 </div>
648 EOT;
649  $this->assertHTMLEquals(
650  $this->brutallyTrimHTML($expected),
651  $this->brutallyTrimHTML($html)
652  );
653  }
$c
Definition: deliver.php:25
getFactory()
Definition: ItemTest.php:35
$r
+ Here is the call graph for this function:

◆ testRenderBase()

ItemTest::testRenderBase ( )

Definition at line 201 of file ItemTest.php.

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

201  : void
202  {
203  $f = $this->getFactory();
204  $r = $this->getDefaultRenderer();
205 
206  $actions = new I\Component\Dropdown\Standard(array(
207  new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
208  new I\Component\Button\Shy("GitHub", "https://www.github.com")
209  ));
210  $c = $f->standard("Item Title")
211  ->withActions($actions)
212  ->withProperties(array(
213  "Origin" => "Course Title 1",
214  "Last Update" => "24.11.2011",
215  "Location" => "Room 123, Main Street 44, 3012 Bern"))
216  ->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.");
217 
218  $html = $r->render($c);
219 
220  $expected = <<<EOT
221  <div class="il-item il-std-item ">
222  <h4 class="il-item-title">Item Title</h4>
223  <div class="il-item-actions l-bar__space-keeper"><div class="l-bar__element"><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>
224  <ul id="id_3_menu" class="dropdown-menu">
225  <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1" >ILIAS</button>
226  </li>
227  <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2" >GitHub</button>
228  </li>
229  </ul>
230  </div></div></div>
231  <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>
232  <hr class="il-item-divider" />
233  <div class="row">
234  <div class="col-md-6 il-multi-line-cap-3">
235  <span class="il-item-property-name">Origin</span><span class="il-item-property-value">Course Title 1</span>
236  </div>
237  <div class="col-md-6 il-multi-line-cap-3">
238  <span class="il-item-property-name">Last Update</span><span class="il-item-property-value">24.11.2011</span>
239  </div>
240  </div>
241  <div class="row">
242  <div class="col-md-6 il-multi-line-cap-3">
243  <span class="il-item-property-name">Location</span><span class="il-item-property-value">Room 123, Main Street 44, 3012 Bern</span>
244  </div>
245  <div class="col-md-6 il-multi-line-cap-3">
246  <span class="il-item-property-name"></span><span class="il-item-property-value"></span>
247  </div>
248  </div>
249  </div>
250 EOT;
251 
252  $this->assertHTMLEquals(
253  $this->brutallyTrimHTML($expected),
254  $this->brutallyTrimHTML($html)
255  );
256  }
button(string $caption, string $cmd)
Interface Observer Contains several chained tasks and infos about them.
Title class.
Definition: Title.php:41
$c
Definition: deliver.php:25
getFactory()
Definition: ItemTest.php:35
$r
+ Here is the call graph for this function:

◆ testRenderLeadIcon()

ItemTest::testRenderLeadIcon ( )

Definition at line 287 of file ItemTest.php.

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

287  : void
288  {
289  $f = $this->getFactory();
290  $r = $this->getDefaultRenderer();
291 
292  $icon = new I\Component\Symbol\Icon\Standard("name", "aria_label", "small", false);
293 
294  $c = $f->standard("title")->withLeadIcon($icon);
295 
296  $html = $r->render($c);
297  $expected = <<<EOT
298 <div class="il-item il-std-item ">
299  <div class="media">
300  <div class="media-left">
301  <img class="icon name small" src="./assets/images/standard/icon_default.svg" alt="aria_label" />
302  </div>
303  <div class="media-body">
304  <h4 class="il-item-title">title</h4>
305  </div>
306  </div>
307 </div>
308 EOT;
309 
310  $this->assertHTMLEquals(
311  $this->brutallyTrimHTML($expected),
312  $this->brutallyTrimHTML($html)
313  );
314  }
$c
Definition: deliver.php:25
getFactory()
Definition: ItemTest.php:35
$r
+ Here is the call graph for this function:

◆ testRenderLeadImage()

ItemTest::testRenderLeadImage ( )

Definition at line 258 of file ItemTest.php.

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

258  : void
259  {
260  $f = $this->getFactory();
261  $r = $this->getDefaultRenderer();
262 
263  $image = new I\Component\Image\Image("standard", "src", "str");
264 
265  $c = $f->standard("title")->withLeadImage($image);
266 
267  $html = $r->render($c);
268  $expected = <<<EOT
269 <div class="il-item il-std-item ">
270  <div class="row">
271  <div class="col-xs-2 col-sm-3">
272  <img src="src" class="img-standard" alt="str" />
273  </div>
274  <div class="col-xs-10 col-sm-9">
275  <h4 class="il-item-title">title</h4>
276  </div>
277  </div>
278 </div>
279 EOT;
280 
281  $this->assertHTMLEquals(
282  $this->brutallyTrimHTML($expected),
283  $this->brutallyTrimHTML($html)
284  );
285  }
$c
Definition: deliver.php:25
getFactory()
Definition: ItemTest.php:35
$r
+ Here is the call graph for this function:

◆ testRenderLeadLetterAvatar()

ItemTest::testRenderLeadLetterAvatar ( )

Definition at line 316 of file ItemTest.php.

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

316  : void
317  {
318  $f = $this->getFactory();
319  $r = $this->getDefaultRenderer();
320 
321  $avatar = new Letter('il');
322 
323  $c = $f->standard("title")->withLeadAvatar($avatar);
324 
325  $html = $r->render($c);
326 
327  $expected = <<<EOT
328 <div class="il-item il-std-item ">
329  <div class="media">
330  <div class="media-left">
331  <span class="il-avatar il-avatar-letter il-avatar-size-large il-avatar-letter-color-11" aria-label="user_avatar" role="img">
332  <span class="abbreviation">il</span>
333  </span>
334  </div>
335  <div class="media-body">
336  <h4 class="il-item-title">title</h4>
337  </div>
338  </div>
339 </div>
340 EOT;
341 
342  $this->assertHTMLEquals(
343  $this->brutallyTrimHTML($expected),
344  $this->brutallyTrimHTML($html)
345  );
346  }
$c
Definition: deliver.php:25
getFactory()
Definition: ItemTest.php:35
$r
+ Here is the call graph for this function:

◆ testRenderLeadPictureAvatar()

ItemTest::testRenderLeadPictureAvatar ( )

Definition at line 348 of file ItemTest.php.

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

348  : void
349  {
350  $f = $this->getFactory();
351  $r = $this->getDefaultRenderer();
352 
353  $avatar = new Picture('./assets/images/placeholder/no_photo_xsmall.jpg', 'demo.user');
354 
355  $c = $f->standard("title")->withLeadAvatar($avatar);
356 
357  $html = $r->render($c);
358  $expected = <<<EOT
359 <div class="il-item il-std-item ">
360  <div class="media">
361  <div class="media-left">
362  <span class="il-avatar il-avatar-picture il-avatar-size-large">
363  <img src="./assets/images/placeholder/no_photo_xsmall.jpg" alt="user_avatar"/>
364  </span>
365  </div>
366  <div class="media-body">
367  <h4 class="il-item-title">title</h4>
368  </div>
369  </div>
370 </div>
371 EOT;
372 
373  $this->assertHTMLEquals(
374  $this->brutallyTrimHTML($expected),
375  $this->brutallyTrimHTML($html)
376  );
377  }
$c
Definition: deliver.php:25
getFactory()
Definition: ItemTest.php:35
$r
+ Here is the call graph for this function:

◆ testRenderLeadTextAndColor()

ItemTest::testRenderLeadTextAndColor ( )

Definition at line 531 of file ItemTest.php.

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

531  : void
532  {
533  $f = $this->getFactory();
534  $r = $this->getDefaultRenderer();
535  $df = new Data\Factory();
536 
537  $color = $df->color('#ff00ff');
538 
539  $c = $f->standard("title")->withColor($color)->withLeadText("lead");
540 
541  $html = $r->render($c);
542 
543  $expected = <<<EOT
544 <div class="il-item il-std-item il-item-marker " style="border-color:#ff00ff">
545  <div class="row">
546  <div class="col-sm-3">
547  lead
548  </div>
549  <div class="col-sm-9">
550  <h4 class="il-item-title">title</h4>
551  </div>
552  </div>
553 </div>
554 EOT;
555 
556  $this->assertHTMLEquals(
557  $this->brutallyTrimHTML($expected),
558  $this->brutallyTrimHTML($html)
559  );
560  }
$c
Definition: deliver.php:25
getFactory()
Definition: ItemTest.php:35
$r
+ Here is the call graph for this function:

◆ testRenderProgress()

ItemTest::testRenderProgress ( )

Definition at line 379 of file ItemTest.php.

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

379  : void
380  {
381  $f = $this->getFactory();
382  $r = $this->getDefaultRenderer();
383 
384  $chart = new I\Component\Chart\ProgressMeter\Standard(100, 75);
385 
386  $c = $f->standard("title")->withProgress($chart);
387 
388  $html = $r->render($c);
389  $expected = <<<EOT
390 <div class="il-item il-std-item ">
391  <div class="row">
392  <div class="col-sm-9">
393  <h4 class="il-item-title">title</h4>
394  </div>
395  <div class="col-xs-3 col-sm-2 col-lg-2">
396  <div class="il-chart-progressmeter-box ">
397  <div class="il-chart-progressmeter-container">
398  <svg viewBox="0 0 50 40" class="il-chart-progressmeter-viewbox">
399  <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>
400  <g class="il-chart-progressmeter-monocircle">
401  <path class="il-chart-progressmeter-circle no-success" stroke-dasharray="71, 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>
402  </g>
403  <g class="il-chart-progressmeter-text">
404  <text class="text-score-info" x="25" y="16"></text>
405  <text class="text-score" x="25" y="25">75 %</text>
406  <text class="text-comparision" x="25" y="31"></text>
407  <text class="text-comparision-info" x="25" y="34"></text>
408  </g>
409  <g class="il-chart-progressmeter-needle no-needle" style="transform: rotate(deg)">
410  <polygon class="il-chart-progressmeter-needle-border" points="23.5,0.1 25,2.3 26.5,0.1"></polygon>
411  <polygon class="il-chart-progressmeter-needle-fill" points="23.5,0 25,2.2 26.5,0"></polygon>
412  </g>
413  </svg>
414  </div>
415  </div>
416  </div>
417  </div>
418 </div>
419 EOT;
420 
421  $this->assertHTMLEquals(
422  $this->brutallyTrimHTML($expected),
423  $this->brutallyTrimHTML($html)
424  );
425  }
$c
Definition: deliver.php:25
getFactory()
Definition: ItemTest.php:35
$r
+ Here is the call graph for this function:

◆ testRenderProgressAndLeadIcon()

ItemTest::testRenderProgressAndLeadIcon ( )

Definition at line 479 of file ItemTest.php.

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

479  : void
480  {
481  $f = $this->getFactory();
482  $r = $this->getDefaultRenderer();
483 
484  $icon = new I\Component\Symbol\Icon\Standard("name", "aria_label", "small", false);
485  $chart = new I\Component\Chart\ProgressMeter\Standard(100, 75);
486 
487  $c = $f->standard("title")->withLeadIcon($icon)->withProgress($chart);
488 
489  $html = $r->render($c);
490  $expected = <<<EOT
491 <div class="il-item il-std-item ">
492  <div class="media">
493  <div class="media-left">
494  <img class="icon name small" src="./assets/images/standard/icon_default.svg" alt="aria_label" />
495  </div>
496  <div class="media-body">
497  <h4 class="il-item-title">title</h4>
498  </div>
499  <div class="media-right">
500  <div class="il-chart-progressmeter-box ">
501  <div class="il-chart-progressmeter-container">
502  <svg viewBox="0 0 50 40" class="il-chart-progressmeter-viewbox">
503  <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>
504  <g class="il-chart-progressmeter-monocircle">
505  <path class="il-chart-progressmeter-circle no-success" stroke-dasharray="71, 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>
506  </g>
507  <g class="il-chart-progressmeter-text">
508  <text class="text-score-info" x="25" y="16"></text>
509  <text class="text-score" x="25" y="25">75 %</text>
510  <text class="text-comparision" x="25" y="31"></text>
511  <text class="text-comparision-info" x="25" y="34"></text>
512  </g>
513  <g class="il-chart-progressmeter-needle no-needle" style="transform: rotate(deg)">
514  <polygon class="il-chart-progressmeter-needle-border" points="23.5,0.1 25,2.3 26.5,0.1"></polygon>
515  <polygon class="il-chart-progressmeter-needle-fill" points="23.5,0 25,2.2 26.5,0"></polygon>
516  </g>
517  </svg>
518  </div>
519  </div>
520  </div>
521  </div>
522 </div>
523 EOT;
524 
525  $this->assertHTMLEquals(
526  $this->brutallyTrimHTML($expected),
527  $this->brutallyTrimHTML($html)
528  );
529  }
$c
Definition: deliver.php:25
getFactory()
Definition: ItemTest.php:35
$r
+ Here is the call graph for this function:

◆ testRenderProgressAndLeadImage()

ItemTest::testRenderProgressAndLeadImage ( )

Definition at line 427 of file ItemTest.php.

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

427  : void
428  {
429  $f = $this->getFactory();
430  $r = $this->getDefaultRenderer();
431 
432  $image = new I\Component\Image\Image("standard", "src", "str");
433  $chart = new I\Component\Chart\ProgressMeter\Standard(100, 75);
434 
435  $c = $f->standard("title")->withLeadImage($image)->withProgress($chart);
436 
437  $html = $r->render($c);
438  $expected = <<<EOT
439 <div class="il-item il-std-item ">
440  <div class="row">
441  <div class="col-xs-3 col-sm-3 col-lg-2">
442  <img src="src" class="img-standard" alt="str" />
443  </div>
444  <div class="col-xs-6 col-sm-7 col-lg-8">
445  <h4 class="il-item-title">title</h4>
446  </div>
447  <div class="col-xs-3 col-sm-2 col-lg-2">
448  <div class="il-chart-progressmeter-box ">
449  <div class="il-chart-progressmeter-container">
450  <svg viewBox="0 0 50 40" class="il-chart-progressmeter-viewbox">
451  <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>
452  <g class="il-chart-progressmeter-monocircle">
453  <path class="il-chart-progressmeter-circle no-success" stroke-dasharray="71, 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>
454  </g>
455  <g class="il-chart-progressmeter-text">
456  <text class="text-score-info" x="25" y="16"></text>
457  <text class="text-score" x="25" y="25">75 %</text>
458  <text class="text-comparision" x="25" y="31"></text>
459  <text class="text-comparision-info" x="25" y="34"></text>
460  </g>
461  <g class="il-chart-progressmeter-needle no-needle" style="transform: rotate(deg)">
462  <polygon class="il-chart-progressmeter-needle-border" points="23.5,0.1 25,2.3 26.5,0.1"></polygon>
463  <polygon class="il-chart-progressmeter-needle-fill" points="23.5,0 25,2.2 26.5,0"></polygon>
464  </g>
465  </svg>
466  </div>
467  </div>
468  </div>
469  </div>
470 </div>
471 EOT;
472 
473  $this->assertHTMLEquals(
474  $this->brutallyTrimHTML($expected),
475  $this->brutallyTrimHTML($html)
476  );
477  }
$c
Definition: deliver.php:25
getFactory()
Definition: ItemTest.php:35
$r
+ Here is the call graph for this function:

◆ testShyTitleAndVariousProperties()

ItemTest::testShyTitleAndVariousProperties ( )

Definition at line 562 of file ItemTest.php.

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

562  : void
563  {
564  $f = $this->getFactory();
565  $r = $this->getDefaultRenderer();
566  $df = new Data\Factory();
567 
568  $df->color('#ff00ff');
569 
570  $c = $f->standard(new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"))
571  ->withProperties([
572  "Property Text" => "Text",
573  "Property HTML" => "<a>Link</a>",
574  "Property Shy" => new I\Component\Button\Shy("GitHub", "https://www.github.com"),
575  "Property Icon" => new I\Component\Symbol\Icon\Standard("name", "aria_label", "small", false)
576  ]);
577 
578  $html = $this->brutallyTrimHTML($r->render($c));
579  $expected = $this->brutallyTrimHTML(<<<EOT
580 <div class="il-item il-std-item ">
581  <h4 class="il-item-title">
582  <button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button>
583  </h4>
584  <hr class="il-item-divider" />
585  <div class="row">
586  <div class="col-md-6 il-multi-line-cap-3">
587  <span class="il-item-property-name">Property Text</span>
588  <span class="il-item-property-value">Text</span>
589  </div>
590  <div class="col-md-6 il-multi-line-cap-3">
591  <span class="il-item-property-name">Property HTML</span>
592  <span class="il-item-property-value">
593  <a>Link</a>
594  </span>
595  </div>
596  </div>
597  <div class="row">
598  <div class="col-md-6 il-multi-line-cap-3">
599  <span class="il-item-property-name">Property Shy</span>
600  <span class="il-item-property-value">
601  <button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button>
602  </span>
603  </div>
604  <div class="col-md-6 il-multi-line-cap-3">
605  <span class="il-item-property-name">Property Icon</span>
606  <span class="il-item-property-value">
607  <img class="icon name small" src="./assets/images/standard/icon_default.svg" alt="aria_label"/>
608  </span>
609  </div>
610  </div>
611 </div>
612 EOT);
613 
614  $this->assertEquals($expected, $html);
615  }
button(string $caption, string $cmd)
$c
Definition: deliver.php:25
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: class.ilias.php:28
getFactory()
Definition: ItemTest.php:35
$r
+ Here is the call graph for this function:

◆ testWithActions()

ItemTest::testWithActions ( )

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: deliver.php:25
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ testWithAudioPlayer()

ItemTest::testWithAudioPlayer ( )

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: deliver.php:25
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ testWithColor()

ItemTest::testWithColor ( )

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: deliver.php:25
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ testWithDescription()

ItemTest::testWithDescription ( )

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: deliver.php:25
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ testWithLeadIcon()

ItemTest::testWithLeadIcon ( )

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: deliver.php:25
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ testWithLeadImage()

ItemTest::testWithLeadImage ( )

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: deliver.php:25
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ testWithLeadLetterAvatar()

ItemTest::testWithLeadLetterAvatar ( )

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: deliver.php:25
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ testWithLeadPictureAvatar()

ItemTest::testWithLeadPictureAvatar ( )

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('./assets/images/placeholder/no_photo_xsmall.jpg', 'demo.user');
147 
148  $c = $f->standard("title")->withLeadAvatar($avatar);
149 
150  $this->assertEquals($avatar, $c->getLead());
151  }
$c
Definition: deliver.php:25
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ testWithLeadText()

ItemTest::testWithLeadText ( )

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: deliver.php:25
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ testWithMainActionButton()

ItemTest::testWithMainActionButton ( )

Definition at line 181 of file ItemTest.php.

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

181  : void
182  {
183  $f = $this->getFactory();
184 
185  $main_action = $this->createMock(I\Component\Button\Standard::class);
186  $c = $f->standard("Title")->withMainAction($main_action);
187 
188  $this->assertEquals($c->getMainAction(), $main_action);
189  }
$c
Definition: deliver.php:25
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ testWithMainActionLink()

ItemTest::testWithMainActionLink ( )

Definition at line 191 of file ItemTest.php.

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

191  : void
192  {
193  $f = $this->getFactory();
194 
195  $main_action = $this->createMock(I\Component\Link\Standard::class);
196  $c = $f->standard("Title")->withMainAction($main_action);
197 
198  $this->assertEquals($c->getMainAction(), $main_action);
199  }
$c
Definition: deliver.php:25
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ testWithNoLead()

ItemTest::testWithNoLead ( )

Definition at line 162 of file ItemTest.php.

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

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: deliver.php:25
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ testWithProgress()

ItemTest::testWithProgress ( )

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: deliver.php:25
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

◆ testWithProperties()

ItemTest::testWithProperties ( )

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: deliver.php:25
getFactory()
Definition: ItemTest.php:35
+ Here is the call graph for this function:

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