19 declare(strict_types=1);
    21 require_once(__DIR__ . 
"/../../../../../../vendor/composer/vendor/autoload.php");
    22 require_once(__DIR__ . 
"/../../Base.php");
    38         return "Component Dummy";
    50             public function panelSecondary(): I\Component\Panel\Secondary\Factory
    52                 return new I\Component\Panel\Secondary\Factory();
    54             public function dropdown(): I\Component\Dropdown\Factory
    56                 return new I\Component\Dropdown\Factory();
    58             public function viewControl(): I\Component\ViewControl\Factory
    62             public function button(): I\Component\Button\Factory
    64                 return new I\Component\Button\Factory();
    66             public function symbol(): C\Symbol\Factory
    68                 return new I\Component\Symbol\Factory(
    79         return new I\Component\Panel\Factory(
    80             $this->createMock(
C\Panel\Listing\Factory::class)
    86         $f = $this->getPanelFactory();
    88         $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Panel\\Factory", 
$f);
    89         $this->assertInstanceOf(
    90             "ILIAS\\UI\\Component\\Panel\\Standard",
    93         $this->assertInstanceOf(
    94             "ILIAS\\UI\\Component\\Panel\\Sub",
    97         $this->assertInstanceOf(
    98             "ILIAS\\UI\\Component\\Panel\\Report",
   105         $f = $this->getPanelFactory();
   108         $this->assertEquals(
"Title", $p->getTitle());
   113         $f = $this->getPanelFactory();
   115         $p = 
$f->standard(
"Title", array(
$c));
   117         $this->assertEquals($p->getContent(), array(
$c));
   122         $fp = $this->getPanelFactory();
   126         $actions = 
new I\Component\Dropdown\Standard(array(
   131         $p = $p->withActions($actions);
   133         $this->assertEquals($p->getActions(), $actions);
   138         $fp = $this->getPanelFactory();
   142         $actions = 
new I\Component\Dropdown\Standard(array(
   147         $p = $p->withActions($actions);
   149         $this->assertEquals($p->getActions(), $actions);
   154         $fp = $this->getPanelFactory();
   158         $card = 
new I\Component\Card\Card(
"Card Title");
   160         $p = $p->withFurtherInformation($card);
   162         $this->assertEquals($p->getFurtherInformation(), $card);
   167         $fp = $this->getPanelFactory();
   171         $legacy = 
new I\Component\Legacy\Legacy(
"Legacy content", 
new SignalGenerator());
   172         $secondary = 
new I\Component\Panel\Secondary\Legacy(
"Legacy panel title", $legacy);
   174         $p = $p->withFurtherInformation($secondary);
   176         $this->assertEquals($p->getFurtherInformation(), $secondary);
   181         $fp = $this->getPanelFactory();
   183         $p = $fp->report(
"Title", $fp->sub(
"Title", array(
new ComponentDummy())));
   185         $actions = 
new I\Component\Dropdown\Standard(array(
   190         $p = $p->withActions($actions);
   192         $this->assertEquals($p->getActions(), $actions);
   197         $f = $this->getPanelFactory();
   199         $p = 
$f->report(
"Title", array($sub));
   201         $this->assertEquals(
"Title", $p->getTitle());
   206         $f = $this->getPanelFactory();
   208         $p = 
$f->report(
"Title", [$sub]);
   210         $this->assertEquals($p->getContent(), array($sub));
   215         $f = $this->getPanelFactory();
   216         $r = $this->getDefaultRenderer();
   218         $actions = 
new I\Component\Dropdown\Standard(array(
   223         $p = 
$f->standard(
"Title", array())->withActions($actions);
   225         $html = 
$r->render($p);
   227         $expected_html = <<<EOT
   228 <div 
class=
"panel panel-primary panel-flex">
   229     <div 
class=
"panel-heading ilHeader">
   230         <div 
class=
"panel-title"><h2>
Title</h2></div>
   231         <div 
class=
"panel-controls">
   232             <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>
   233                 <ul 
id=
"id_3_menu" class=
"dropdown-menu">
   234                     <li><
button class=
"btn btn-link" data-action=
"https://www.ilias.de" id=
"id_1">
ILIAS</button></li>
   235                     <li><button 
class=
"btn btn-link" data-action=
"https://www.github.com" id=
"id_2">GitHub</button></li>
   240     <div 
class=
"panel-body"></div>
   243         $this->assertHTMLEquals($expected_html, $html);
   248         $fp = $this->getPanelFactory();
   249         $r = $this->getDefaultRenderer();
   251         $actions = 
new I\Component\Dropdown\Standard(array(
   256         $p = $fp->sub(
"Title", array())->withActions($actions);
   257         $card = 
new I\Component\Card\Card(
"Card Title");
   259         $p = $p->withFurtherInformation($card);
   260         $html = $this->brutallyTrimHTML(
$r->render($p));
   262         $expected_html = <<<EOT
   263 <div 
class=
"panel panel-sub panel-flex">
   264     <div 
class=
"panel-heading ilBlockHeader">
   266         <div 
class=
"panel-controls">
   267             <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>
   268                 <ul 
id=
"id_3_menu" class=
"dropdown-menu">
   269                     <li><
button class=
"btn btn-link" data-action=
"https://www.ilias.de" id=
"id_1">
ILIAS</button></li>
   270                     <li><button 
class=
"btn btn-link" data-action=
"https://www.github.com" id=
"id_2">GitHub</button></li>
   275     <div 
class=
"panel-body">
   277             <div 
class=
"col-sm-8"></div>
   278             <div 
class=
"col-sm-4">
   279                 <div 
class=
"il-card thumbnail">
   280                     <div 
class=
"card-no-highlight"></div>
   281                     <div 
class=
"caption card-title">
Card Title</div>
   289         $this->assertHTMLEquals($this->brutallyTrimHTML($expected_html), $html);
   294         $fp = $this->getPanelFactory();
   295         $r = $this->getDefaultRenderer();
   297         $p = $fp->sub(
"Title", array());
   298         $legacy = 
new I\Component\Legacy\Legacy(
"Legacy content", 
new SignalGenerator());
   299         $secondary = 
new I\Component\Panel\Secondary\Legacy(
"Legacy panel title", $legacy);
   300         $p = $p->withFurtherInformation($secondary);
   301         $html = 
$r->render($p);
   303         $expected_html = <<<EOT
   304 <div 
class=
"panel panel-sub panel-flex">
   305     <div 
class=
"panel-heading ilBlockHeader">
   307         <div 
class=
"panel-controls"></div>
   309     <div 
class=
"panel-body">
   311             <div 
class=
"col-sm-8"></div>
   312             <div 
class=
"col-sm-4">
   313                 <div 
class=
"panel panel-secondary panel-flex">
   314                     <div 
class=
"panel-heading ilHeader">
   315                         <div 
class=
"panel-title"><h2>Legacy panel title</h2></div>
   316                         <div 
class=
"panel-controls"></div>
   318                     <div 
class=
"panel-body">Legacy content</div>
   326         $this->assertHTMLEquals(
   327             $this->brutallyTrimHTML($expected_html),
   328             $this->brutallyTrimHTML($html)
   334         $fp = $this->getPanelFactory();
   335         $r = $this->getDefaultRenderer();
   337         $actions = 
new I\Component\Dropdown\Standard(array(
   342         $sub = $fp->sub(
"Title", array());
   343         $card = 
new I\Component\Card\Card(
"Card Title");
   344         $sub = $sub->withFurtherInformation($card);
   345         $report = $fp->report(
"Title", $sub)->withActions($actions);
   347         $html = $this->brutallyTrimHTML(
$r->render($report));
   349         $expected_html = <<<EOT
   350 <div 
class=
"panel panel-primary il-panel-report panel-flex">
   351     <div 
class=
"panel-heading ilHeader">
   352         <div 
class=
"panel-title"><h2>
Title</h2></div>
   353         <div 
class=
"panel-controls">
   354             <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>
   355                 <ul 
id=
"id_3_menu" class=
"dropdown-menu">
   356                     <li><
button class=
"btn btn-link" data-action=
"https://www.ilias.de" id=
"id_1">
ILIAS</button></li>
   357                     <li><button 
class=
"btn btn-link" data-action=
"https://www.github.com" id=
"id_2">GitHub</button></li>
   362     <div 
class=
"panel-body">
   363         <div 
class=
"panel panel-sub panel-flex">
   364             <div 
class=
"panel-heading ilBlockHeader">
   366                 <div 
class=
"panel-controls"></div>
   368             <div 
class=
"panel-body"><div 
class=
"row">
   369                 <div 
class=
"col-sm-8"></div>
   370                     <div 
class=
"col-sm-4">
   371                         <div 
class=
"il-card thumbnail">
   372                             <div 
class=
"card-no-highlight"></div>
   373                             <div 
class=
"caption card-title">
Card Title</div>
   383         $this->assertHTMLEquals($this->brutallyTrimHTML($expected_html), $html);
   392         $sortation = $this->getUIFactory()->viewControl()->sortation($sort_options, 
'a');
   393         $f = $this->getPanelFactory();
   394         $p = 
$f->standard(
"Title", [])
   395             ->withViewControls([$sortation])
   398         $this->assertEquals($p->getViewControls(), [$sortation]);
   407         $sortation = $this->getUIFactory()->viewControl()->sortation($sort_options, 
'a');
   408         $f = $this->getPanelFactory();
   409         $p = 
$f->report(
"Title", [])
   410             ->withViewControls([$sortation])
   413         $this->assertEquals($p->getViewControls(), [$sortation]);
   422         $mode = $this->getUIFactory()->viewControl()->mode($modes, 
'Presentation Mode');
   424         $f = $this->getPanelFactory();
   425         $r = $this->getDefaultRenderer();
   428         $p = 
$f->report(
"Title", [])
   429             ->withViewControls([$mode]);
   431         $html = 
$r->render($p);
   433         $expected_html = <<<EOT
   434 <div 
class=
"panel panel-primary il-panel-report panel-flex">
   435     <div 
class=
"panel-heading ilHeader">
   436         <div 
class=
"panel-title"><h2>
Title</h2></div>
   437         <div 
class=
"panel-viewcontrols l-bar__space-keeper">
   438             <div 
class=
"il-viewcontrol-mode l-bar__element" aria-label=
"Presentation Mode" role=
"group">
   439                 <
button class=
"btn btn-default engaged" aria-pressed=
"true" data-action=
"a" id=
"id_1">
A</
button>
   440                 <
button class=
"btn btn-default" aria-pressed=
"false" data-action=
"b" id=
"id_2">
B</button>
   443         <div 
class=
"panel-controls"></div>
   445     <div 
class=
"panel-body"></div>
   449             $this->brutallyTrimHTML($expected_html),
   450             $this->brutallyTrimHTML($html)
   461         $sortation = $this->getUIFactory()->viewControl()->sortation($sort_options, 
'b');
   463         $f = $this->getPanelFactory();
   464         $r = $this->getDefaultRenderer();
   467         $p = 
$f->standard(
"Title", [])
   468             ->withViewControls([$sortation]);
   470         $html = 
$r->render($p);
   472         $expected_html = <<<EOT
   473 <div 
class=
"panel panel-primary panel-flex">
   474     <div 
class=
"panel-heading ilHeader">
   475         <div 
class=
"panel-title"><h2>
Title</h2></div>
   476         <div 
class=
"panel-viewcontrols l-bar__space-keeper">
   477             <div 
class=
"dropdown il-viewcontrol il-viewcontrol-sortation l-bar__element" id=
"id_1">
   478                 <
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">
   479                     <span 
class=
"label">vc_sort 
B</span>
   480                     <span 
class=
"caret"></span>
   482                 <ul 
id=
"id_1_ctrl" class=
"dropdown-menu">
   483                    <li><
button class=
"btn btn-link" data-action=
"?sortation=a" id=
"id_2">
A</button></li>
   484                    <li 
class=
"selected"><button 
class=
"btn btn-link" data-action=
"?sortation=b" id=
"id_3">
B</button></li>
   488         <div 
class=
"panel-controls"></div>
   490     <div 
class=
"panel-body"></div>
   494             $this->brutallyTrimHTML($expected_html),
   495             $this->brutallyTrimHTML($html)
   501         $pagination = $this->getUIFactory()->viewControl()->pagination()
   502             ->withTargetURL(
'http://ilias.de', 
'page')
   503             ->withTotalEntries(10)
   505             ->withCurrentPage(1);
   507         $f = $this->getPanelFactory();
   508         $r = $this->getDefaultRenderer();
   511         $p = 
$f->standard(
"Title", [])
   512             ->withViewControls([$pagination]);
   514         $html = 
$r->render($p);
   516         $expected_html = <<<EOT
   517 <div 
class=
"panel panel-primary panel-flex">
   518     <div 
class=
"panel-heading ilHeader">
   519         <div 
class=
"panel-title"><h2>
Title</h2></div>
   520         <div 
class=
"panel-viewcontrols l-bar__space-keeper">
   521             <div 
class=
"il-viewcontrol-pagination l-bar__element">
   522                 <
button class=
"btn btn-default" data-action=
"http://ilias.de?page=0" id=
"id_6">
   523                     <span 
class=
"glyph" aria-label=
"back" role=
"img"><span 
class=
"glyphicon glyphicon-chevron-left" aria-hidden=
"true"></span></span>
   525                 <
button class=
"btn btn-link" data-action=
"http://ilias.de?page=0" id=
"id_1">1</button>
   526                 <button 
class=
"btn btn-link engaged" aria-pressed=
"true" data-action=
"http://ilias.de?page=1" id=
"id_2">2</button>
   527                 <button 
class=
"btn btn-link" data-action=
"http://ilias.de?page=2" id=
"id_3">3</button>
   528                 <button 
class=
"btn btn-link" data-action=
"http://ilias.de?page=3" id=
"id_4">4</button>
   529                 <button 
class=
"btn btn-link" data-action=
"http://ilias.de?page=4" id=
"id_5">5</button>
   530                 <button 
class=
"btn btn-default" data-action=
"http://ilias.de?page=2" id=
"id_7">
   531                     <span 
class=
"glyph" aria-label=
"next" role=
"img"><span 
class=
"glyphicon glyphicon-chevron-right" aria-hidden=
"true"></span></span>
   535         <div 
class=
"panel-controls"></div>
   537     <div 
class=
"panel-body"></div>
   541             $this->brutallyTrimHTML($expected_html),
   542             $this->brutallyTrimHTML($html)
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
button(string $caption, string $cmd)
 
testRenderReportWithMode()
 
Test on button implementation. 
 
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...
 
testStandardWithActions()
 
testStandardWithViewControls()
 
testRenderWithPagination()
 
getCanonicalName()
Get the canonical name of the component. 
 
testImplementsFactoryInterface()
 
testSubWithSecondaryPanel()
 
testRenderSubWithSecondaryPanel()
 
testReportWithViewControls()
 
testRenderWithSortation()