19 declare(strict_types=1);
21 require_once(
"vendor/composer/vendor/autoload.php");
22 require_once(__DIR__ .
"/../../../Base.php");
63 $this->metabar = $this->createMock(MetaBar::class);
64 $this->metabar->method(
"getCanonicalName")->willReturn(
"MetaBar Stub");
65 $this->
mainbar = $this->createMock(MainBar::class);
66 $this->
mainbar->method(
"getCanonicalName")->willReturn(
"MainBar Stub");
67 $this->crumbs = $this->createMock(Breadcrumbs::class);
68 $this->crumbs->method(
"getCanonicalName")->willReturn(
"Breadcrumbs Stub");
69 $this->logo = $this->createMock(Image::class);
70 $this->logo->method(
"getCanonicalName")->willReturn(
"Logo Stub");
71 $this->responsive_logo = $this->createMock(Image::class);
72 $this->responsive_logo->method(
"getCanonicalName")->willReturn(
"Responsive Logo Stub");
73 $this->overlay = $this->createMock(Container::class);
74 $this->overlay->method(
"getCanonicalName")->willReturn(
"Overlay Stub");
75 $this->contents = array(
new Content(
'some content', $sig_gen));
76 $this->title =
'pagetitle';
78 $this->
factory =
new Page\Factory();
79 $this->stdpage = $this->
factory->standard(
85 $this->responsive_logo,
95 $this->assertInstanceOf(
96 "ILIAS\\UI\\Component\\Layout\\Page\\Standard",
105 $this->stdpage->getContent()
113 $this->stdpage->getMetabar()
121 $this->stdpage->getMainbar()
129 $this->stdpage->getBreadcrumbs()
137 $this->stdpage->getLogo()
143 $this->assertTrue($this->stdpage->hasLogo());
149 $this->responsive_logo,
150 $this->stdpage->getResponsiveLogo()
156 $this->assertTrue($this->stdpage->hasResponsiveLogo());
161 $this->assertEquals(
"logo/favicon.ico", $this->stdpage->getFaviconPath());
164 $this->stdpage->withFaviconPath(
"test")->getFaviconPath()
172 $this->stdpage->getOverlay()
178 $this->expectException(TypeError::class);
179 $this->stdpage = $this->
factory->standard(
182 'string is not allowed here',
192 $this->stdpage->getTitle()
198 $title =
'some title';
201 $this->stdpage->withTitle($title)->getTitle()
207 $title =
'some short title';
210 $this->stdpage->withShortTitle($title)->getShortTitle()
216 $title =
'some view title';
219 $this->stdpage->withViewTitle($title)->getViewTitle()
225 $this->assertEquals(
"ltr", $this->stdpage->getTextDirection());
229 ->withTextDirection($this->stdpage::RTL)
236 $meta_datum_html =
'test_html';
240 $this->stdpage->withAdditionalMetaDatum($meta_datum)->getMetaData()
246 $this->stdpage = $this->stdpage
248 ->withViewTitle(
"View Title")
249 ->withShortTitle(
"Short Title");
251 $r = $this->getDefaultRenderer(
253 [$this->metabar, $this->
mainbar, $this->crumbs, $this->logo, $this->overlay]
255 $html = $this->brutallyTrimHTML(
$r->render($this->stdpage));
257 $exptected = $this->brutallyTrimHTML(
259 <html lang="en" dir="ltr"> 262 <meta charset="utf-8" /> 263 <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 264 <meta name="viewport" content="width=device-width, initial-scale=1" /> 265 <title>View Title: Short Title</title> 266 <link rel="icon" href="logo/favicon.ico" type="image/x-icon"> 267 <script type="application/javascript">var il = il ||{}; window.il = il;</script> 272 <div class="il-page-overlay">Overlay Stub</div> 273 <div class="il-layout-page"> 275 <div class="header-inner"> 276 <div class="il-logo"><span class="hidden-xs">Logo Stub</span><span class="visible-xs-block">Responsive Logo Stub</span> 277 <div class="il-pagetitle">Title</div> 281 <div class="il-system-infos"></div> 282 <div class="nav il-maincontrols">MainBar Stub</div> 283 <main class="il-layout-page-content">some content</main> 285 <script>il.Util.addOnLoad(function() {});</script> 290 $this->assertEquals($exptected, $html);
295 $this->stdpage = $this->stdpage->withTextDirection($this->stdpage::RTL);
297 $r = $this->getDefaultRenderer(
299 [$this->metabar, $this->
mainbar, $this->crumbs, $this->logo, $this->overlay]
301 $html = $this->brutallyTrimHTML(
$r->render($this->stdpage));
303 $exptected = $this->brutallyTrimHTML(
305 <html lang="en" dir="rtl"> 308 <meta charset="utf-8" /> 309 <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 310 <meta name="viewport" content="width=device-width, initial-scale=1" /> 312 <link rel="icon" href="logo/favicon.ico" type="image/x-icon"> 313 <script type="application/javascript">var il = il ||{}; window.il = il;</script> 318 <div class="il-page-overlay">Overlay Stub</div> 319 <div class="il-layout-page"> 321 <div class="header-inner"> 322 <div class="il-logo"><span class="hidden-xs">Logo Stub</span><span class="visible-xs-block">Responsive Logo Stub</span> 323 <div class="il-pagetitle">pagetitle</div> 327 <div class="il-system-infos"></div> 328 <div class="nav il-maincontrols">MainBar Stub</div> 329 <main class="il-layout-page-content">some content</main> 331 <script>il.Util.addOnLoad(function() {});</script> 336 $this->assertEquals($exptected, $html);
341 $meta_datum_1_html =
'test_html_1';
342 $meta_datum_2_html =
'test_html_2';
343 $meta_datum_1 = $this->
getMockedTag($meta_datum_1_html);
344 $meta_datum_2 = $this->
getMockedTag($meta_datum_2_html);
346 $this->stdpage = $this->stdpage->withAdditionalMetaDatum($meta_datum_1);
347 $this->stdpage = $this->stdpage->withAdditionalMetaDatum($meta_datum_2);
349 $r = $this->getDefaultRenderer(
351 [$this->metabar, $this->
mainbar, $this->crumbs, $this->logo, $this->overlay]
353 $html = $this->brutallyTrimHTML(
$r->render($this->stdpage));
354 $expected = $this->brutallyTrimHTML(
357 <html lang="en" dir="ltr"> 360 <meta charset="utf-8" /> 361 <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 362 <meta name="viewport" content="width=device-width, initial-scale=1" /> 363 ' . $meta_datum_1_html . $meta_datum_2_html .
' 365 <link rel="icon" href="logo/favicon.ico" type="image/x-icon"> 366 <script type="application/javascript">var il = il ||{}; window.il = il;</script> 371 <div class="il-page-overlay">Overlay Stub</div> 372 <div class="il-layout-page"> 374 <div class="header-inner"> 375 <div class="il-logo"><span class="hidden-xs">Logo Stub</span><span class="visible-xs-block">Responsive Logo Stub</span> 376 <div class="il-pagetitle">pagetitle</div> 380 <div class="il-system-infos"></div> 381 <div class="nav il-maincontrols">MainBar Stub</div> 382 <main class="il-layout-page-content">some content</main> 384 <script>il.Util.addOnLoad(function() {});</script> 389 $this->assertEquals($expected, $html);
395 public function button(): Button\Factory
397 return new Button\Factory();
414 $crumbs =
new Crumbs([
419 $r = $this->getDefaultRenderer(
null, [$this->metabar, $this->
mainbar, $this->logo, $this->overlay]);
421 $stdpage = $this->
factory->standard(
427 $this->responsive_logo,
434 $html = $this->brutallyTrimHTML(
$r->render($stdpage));
436 $exptected = $this->brutallyTrimHTML(
438 <html lang="en" dir="ltr"> 441 <meta charset="utf-8" /> 442 <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 443 <meta name="viewport" content="width=device-width, initial-scale=1" /> 445 <link rel="icon" href="logo/favicon.ico" type="image/x-icon"> 446 <script type="application/javascript">var il = il ||{}; window.il = il;</script> 451 <div class="il-page-overlay">Overlay Stub</div> 452 <div class="il-layout-page"> 454 <div class="header-inner"> 455 <div class="il-logo"><span class="hidden-xs">Logo Stub</span><span class="visible-xs-block">Responsive Logo Stub</span> 456 <div class="il-pagetitle">pagetitle</div> 458 <nav class="il-header-locator"> 459 <div class="dropdown" id="id_3"><button class="btn btn-default dropdown-toggle" type="button" aria-haspopup="true" aria-expanded="false" aria-controls="id_3_menu">label3<span class="caret"></span></button> 460 <ul id="id_3_menu" class="dropdown-menu"> 461 <li><button class="btn btn-link" data-action="#" id="id_1">label2</button></li> 462 <li><button class="btn btn-link" data-action="#" id="id_2">label1</button></li> 468 <div class="il-system-infos"></div> 469 <div class="nav il-maincontrols">MainBar Stub</div> 470 <main class="il-layout-page-content"> 471 <div class="breadcrumbs"> 472 <nav aria-label="breadcrumbs_aria_label" class="breadcrumb_wrapper"> 473 <div class="breadcrumb"><span class="crumb"><a href="#">label1</a></span><span class="crumb"><a href="#">label2</a></span><span class="crumb"><a href="#">label3</a></span></div> 478 <script>il.Util.addOnLoad(function() {});</script> 483 $this->assertEquals($exptected, $html);
488 return new class ($html) extends Html\
Tag {
490 protected string $html
494 public function toHtml():
string
button(string $caption, string $cmd)
This describes the MainBar.
testRenderingWithMetaData()
mainbar()
expected output: > ILIAS shows a link "Full Screen Page Layout".
Tests for the Standard Page.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This describes the MetaBar.
__construct(Container $dic, ilPlugin $plugin)
getMockedTag(string $html)
testRenderingWithCrumbs()
testRenderingWithRtlLanguage()