19 declare(strict_types=1);
    21 require_once(__DIR__ . 
"/../../../../../../vendor/composer/vendor/autoload.php");
    22 require_once(__DIR__ . 
"/../../Base.php");
    37         return new I\Component\Item\Factory();
    44         $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Item\\Standard", 
$f->standard(
"title"));
    50         $c = 
$f->standard(
"title");
    52         $this->assertEquals(
"title", 
$c->getTitle());
    59         $c = 
$f->standard(
"title")->withDescription(
"description");
    61         $this->assertEquals(
"description", 
$c->getDescription());
    68         $props = array(
"prop1" => 
"val1", 
"prop2" => 
"val2");
    69         $c = 
$f->standard(
"title")->withProperties($props);
    71         $this->assertEquals(
$c->getProperties(), $props);
    77         $chart = 
new I\Component\Chart\ProgressMeter\ProgressMeter(100, 50);
    79         $c = 
$f->standard(
"title")->withProgress($chart);
    81         $this->assertEquals(
$c->getProgress(), $chart);
    88         $actions = 
new I\Component\Dropdown\Standard(array(
    92         $c = 
$f->standard(
"title")->withActions($actions);
    94         $this->assertEquals(
$c->getActions(), $actions);
   100         $df = 
new Data\Factory();
   102         $color = $df->color(
'#ff00ff');
   104         $c = 
$f->standard(
"title")->withColor($color);
   106         $this->assertEquals(
$c->getColor(), $color);
   113         $image = 
new I\Component\Image\Image(
"standard", 
"src", 
"str");
   115         $c = 
$f->standard(
"title")->withLeadImage($image);
   117         $this->assertEquals(
$c->getLead(), $image);
   124         $icon = 
new I\Component\Symbol\Icon\Standard(
"name", 
"aria_label", 
"small", 
false);
   126         $c = 
$f->standard(
"title")->withLeadIcon($icon);
   128         $this->assertEquals($icon, 
$c->getLead());
   135         $avatar = 
new Letter(
'il');
   137         $c = 
$f->standard(
"title")->withLeadAvatar($avatar);
   139         $this->assertEquals($avatar, 
$c->getLead());
   146         $avatar = 
new Picture(
'./assets/images/placeholder/no_photo_xsmall.jpg', 
'demo.user');
   148         $c = 
$f->standard(
"title")->withLeadAvatar($avatar);
   150         $this->assertEquals($avatar, 
$c->getLead());
   157         $c = 
$f->standard(
"title")->withLeadText(
"text");
   159         $this->assertEquals(
"text", 
$c->getLead());
   166         $c = 
$f->standard(
"title")->withLeadText(
"text")->withNoLead();
   168         $this->assertEquals(null, 
$c->getLead());
   175         $audio = 
new I\Component\Player\Audio(
"src", 
"transcript");
   176         $c = 
$f->standard(
"title")->withAudioPlayer($audio);
   178         $this->assertEquals(
$c->getAudioPlayer(), $audio);
   186         $c = 
$f->standard(
"Title")->withMainAction($main_action);
   188         $this->assertEquals(
$c->getMainAction(), $main_action);
   195         $main_action = $this->createMock(
I\
Component\
Link\Standard::class);
   196         $c = 
$f->standard(
"Title")->withMainAction($main_action);
   198         $this->assertEquals(
$c->getMainAction(), $main_action);
   204         $r = $this->getDefaultRenderer();
   206         $actions = 
new I\Component\Dropdown\Standard(array(
   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.");
   218         $html = 
$r->render(
$c);
   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>
   227                         <li><button 
class=
"btn btn-link" data-action=
"https://www.github.com" id=
"id_2"  >GitHub</button>
   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" />
   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>
   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>
   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>
   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>
   252         $this->assertHTMLEquals(
   253             $this->brutallyTrimHTML($expected),
   254             $this->brutallyTrimHTML($html)
   261         $r = $this->getDefaultRenderer();
   263         $image = 
new I\Component\Image\Image(
"standard", 
"src", 
"str");
   265         $c = 
$f->standard(
"title")->withLeadImage($image);
   267         $html = 
$r->render(
$c);
   269 <div 
class=
"il-item il-std-item ">
   271                 <div 
class=
"col-xs-2 col-sm-3">
   272                         <img src=
"src" class=
"img-standard" alt=
"str" />
   274                 <div 
class=
"col-xs-10 col-sm-9">
   275             <h4 
class=
"il-item-title">title</h4>
   281         $this->assertHTMLEquals(
   282             $this->brutallyTrimHTML($expected),
   283             $this->brutallyTrimHTML($html)
   290         $r = $this->getDefaultRenderer();
   292         $icon = 
new I\Component\Symbol\Icon\Standard(
"name", 
"aria_label", 
"small", 
false);
   294         $c = 
$f->standard(
"title")->withLeadIcon($icon);
   296         $html = 
$r->render(
$c);
   298 <div 
class=
"il-item il-std-item ">
   300                 <div 
class=
"media-left">
   301                         <img 
class=
"icon name small" src=
"./assets/images/standard/icon_default.svg" alt=
"aria_label" />
   303                 <div 
class=
"media-body">
   304             <h4 
class=
"il-item-title">title</h4>
   310         $this->assertHTMLEquals(
   311             $this->brutallyTrimHTML($expected),
   312             $this->brutallyTrimHTML($html)
   319         $r = $this->getDefaultRenderer();
   321         $avatar = 
new Letter(
'il');
   323         $c = 
$f->standard(
"title")->withLeadAvatar($avatar);
   325         $html = 
$r->render(
$c);
   328 <div 
class=
"il-item il-std-item ">
   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>
   335         <div 
class=
"media-body">
   336             <h4 
class=
"il-item-title">title</h4>
   342         $this->assertHTMLEquals(
   343             $this->brutallyTrimHTML($expected),
   344             $this->brutallyTrimHTML($html)
   351         $r = $this->getDefaultRenderer();
   353         $avatar = 
new Picture(
'./assets/images/placeholder/no_photo_xsmall.jpg', 
'demo.user');
   355         $c = 
$f->standard(
"title")->withLeadAvatar($avatar);
   357         $html = 
$r->render(
$c);
   359 <div 
class=
"il-item il-std-item ">
   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"/>
   366         <div 
class=
"media-body">
   367             <h4 
class=
"il-item-title">title</h4>
   373         $this->assertHTMLEquals(
   374             $this->brutallyTrimHTML($expected),
   375             $this->brutallyTrimHTML($html)
   382         $r = $this->getDefaultRenderer();
   384         $chart = 
new I\Component\Chart\ProgressMeter\Standard(100, 75);
   386         $c = 
$f->standard(
"title")->withProgress($chart);
   388         $html = 
$r->render(
$c);
   390 <div 
class=
"il-item il-std-item ">
   392             <div 
class=
"col-sm-9">
   393             <h4 
class=
"il-item-title">title</h4>
   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>
   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>
   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>
   421         $this->assertHTMLEquals(
   422             $this->brutallyTrimHTML($expected),
   423             $this->brutallyTrimHTML($html)
   430         $r = $this->getDefaultRenderer();
   432         $image = 
new I\Component\Image\Image(
"standard", 
"src", 
"str");
   433         $chart = 
new I\Component\Chart\ProgressMeter\Standard(100, 75);
   435         $c = 
$f->standard(
"title")->withLeadImage($image)->withProgress($chart);
   437         $html = 
$r->render(
$c);
   439 <div 
class=
"il-item il-std-item ">
   441             <div 
class=
"col-xs-3 col-sm-3 col-lg-2">
   442                         <img src=
"src" class=
"img-standard" alt=
"str" />
   444             <div 
class=
"col-xs-6 col-sm-7 col-lg-8">
   445             <h4 
class=
"il-item-title">title</h4>
   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>
   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>
   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>
   473         $this->assertHTMLEquals(
   474             $this->brutallyTrimHTML($expected),
   475             $this->brutallyTrimHTML($html)
   482         $r = $this->getDefaultRenderer();
   484         $icon = 
new I\Component\Symbol\Icon\Standard(
"name", 
"aria_label", 
"small", 
false);
   485         $chart = 
new I\Component\Chart\ProgressMeter\Standard(100, 75);
   487         $c = 
$f->standard(
"title")->withLeadIcon($icon)->withProgress($chart);
   489         $html = 
$r->render(
$c);
   491 <div 
class=
"il-item il-std-item ">
   493                 <div 
class=
"media-left">
   494                         <img 
class=
"icon name small" src=
"./assets/images/standard/icon_default.svg" alt=
"aria_label" />
   496                 <div 
class=
"media-body">
   497             <h4 
class=
"il-item-title">title</h4>
   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>
   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>
   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>
   525         $this->assertHTMLEquals(
   526             $this->brutallyTrimHTML($expected),
   527             $this->brutallyTrimHTML($html)
   534         $r = $this->getDefaultRenderer();
   535         $df = 
new Data\Factory();
   537         $color = $df->color(
'#ff00ff');
   539         $c = 
$f->standard(
"title")->withColor($color)->withLeadText(
"lead");
   541         $html = 
$r->render(
$c);
   544 <div 
class=
"il-item il-std-item il-item-marker " style=
"border-color:#ff00ff">
   546                 <div 
class=
"col-sm-3">
   549                 <div 
class=
"col-sm-9">
   550             <h4 
class=
"il-item-title">title</h4>
   556         $this->assertHTMLEquals(
   557             $this->brutallyTrimHTML($expected),
   558             $this->brutallyTrimHTML($html)
   565         $r = $this->getDefaultRenderer();
   566         $df = 
new Data\Factory();
   568         $df->color(
'#ff00ff');
   572                 "Property Text" => 
"Text",
   573                 "Property HTML" => 
"<a>Link</a>",
   574                 "Property Shy" => 
new I\
Component\
Button\Shy(
"GitHub", 
"https://www.github.com"),
   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">
   584     <hr 
class=
"il-item-divider" />
   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>
   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">
   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>
   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"/>
   614         $this->assertEquals($expected, $html);
   620         $r = $this->getDefaultRenderer();
   623         $html = 
$r->render(
$c);
   626 <div 
class=
"il-item il-std-item "><h4 
class=
"il-item-title"><a href=
"https://www.ilias.de">
ILIAS</a></h4></div>
   629         $this->assertHTMLEquals($expected, $html);
   635         $r = $this->getDefaultRenderer();
   637         $audio = 
new I\Component\Player\Audio(
"src", 
"");
   638         $c = 
$f->standard(
"title")->withAudioPlayer($audio);
   640         $html = 
$r->render(
$c);
   643 <div 
class=
"il-item il-std-item ">
   644     <h4 
class=
"il-item-title">title</h4>
   645     <div 
class=
"il-item-audio"><div 
class=
"il-audio-container">
   646     <audio controls 
class=
"il-audio-player" id=
"" src=
"src" preload=
"metadata"></audio>
   651             $this->brutallyTrimHTML($expected),
   652             $this->brutallyTrimHTML($html)
   662         $main_action->method(
'getCanonicalName')->willReturn($expected_button_html);
   664         $c = 
$f->standard(
"Title")->withMainAction($main_action);
   666         $html = $this->getDefaultRenderer(null, [
   671         <div 
class=
"il-item il-std-item ">
   672             <h4 
class=
"il-item-title">
Title</h4>
   673             <div 
class=
"il-item-actions l-bar__space-keeper">
   674                 <div 
class=
"l-bar__element">$expected_button_html
   680         $this->assertHTMLEquals(
   681             $this->brutallyTrimHTML($expected),
   682             $this->brutallyTrimHTML($html)
   690         $main_action = $this->createMock(
I\
Component\
Link\Standard::class);
   691         $main_action->method(
'getCanonicalName')->willReturn($expected_link_html);
   693         $c = 
$f->standard(
"Title")->withMainAction($main_action);
   695         $html = $this->getDefaultRenderer(null, [
   700         <div 
class=
"il-item il-std-item ">
   701             <h4 
class=
"il-item-title">
Title</h4>
   702             <div 
class=
"il-item-actions l-bar__space-keeper">
   703                 <div 
class=
"l-bar__element">$expected_link_html</div>
   708         $this->assertHTMLEquals(
   709             $this->brutallyTrimHTML($expected),
   710             $this->brutallyTrimHTML($html)
 testWithLeadPictureAvatar()
 
button(string $caption, string $cmd)
 
A Link is the often used combination of a label and an URL. 
 
Interface Observer  Contains several chained tasks and infos about them. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
testRenderLeadPictureAvatar()
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
testRenderLeadLetterAvatar()
 
testWithLeadLetterAvatar()
 
testRenderProgressAndLeadImage()
 
testRenderProgressAndLeadIcon()
 
testRenderLeadTextAndColor()
 
testShyTitleAndVariousProperties()
 
testWithMainActionButton()
 
testImplementsFactoryInterface()
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...