5 require_once(
"libs/composer/vendor/autoload.php");
6 require_once(__DIR__ .
"/../../../Base.php");
8 use \ILIAS\UI\Component as
C;
9 use \ILIAS\UI\Component\MainControls\MetaBar;
10 use \ILIAS\UI\Component\MainControls\MainBar;
11 use \ILIAS\UI\Component\Breadcrumbs\Breadcrumbs;
12 use \ILIAS\UI\Component\Image\Image;
13 use \ILIAS\UI\Implementation\Component\Layout\Page;
14 use \ILIAS\UI\Implementation\Component\Legacy\Legacy;
53 $sig_gen = new \ILIAS\UI\Implementation\Component\SignalGenerator();
54 $this->
metabar = $this->createMock(MetaBar::class);
55 $this->
metabar->method(
"getCanonicalName")->willReturn(
"MetaBar Stub");
56 $this->
mainbar = $this->createMock(MainBar::class);
57 $this->
mainbar->method(
"getCanonicalName")->willReturn(
"MainBar Stub");
58 $this->crumbs = $this->createMock(Breadcrumbs::class);
59 $this->crumbs->method(
"getCanonicalName")->willReturn(
"Breadcrumbs Stub");
60 $this->logo = $this->createMock(Image::class);
61 $this->logo->method(
"getCanonicalName")->willReturn(
"Logo Stub");
62 $this->responsive_logo = $this->createMock(Image::class);
63 $this->responsive_logo->method(
"getCanonicalName")->willReturn(
"Responsive Logo Stub");
64 $this->contents = array(
new Legacy(
'some content', $sig_gen));
65 $this->title =
'pagetitle';
67 $this->factory =
new Page\Factory();
68 $this->stdpage = $this->factory->standard(
76 )->withResponsiveLogo($this->responsive_logo);
81 $this->assertInstanceOf(
82 "ILIAS\\UI\\Component\\Layout\\Page\\Standard",
91 $this->stdpage->getContent()
99 $this->stdpage->getMetabar()
107 $this->stdpage->getMainbar()
115 $this->stdpage->getBreadcrumbs()
123 $this->stdpage->getLogo()
129 $this->assertTrue($this->stdpage->hasLogo());
135 $this->responsive_logo,
136 $this->stdpage->getResponsiveLogo()
142 $this->assertTrue($this->stdpage->hasResponsiveLogo());
147 $this->expectException(TypeError::class);
148 $this->stdpage = $this->factory->standard(
151 'string is not allowed here',
161 $this->stdpage->getTitle()
167 $title =
'some title';
170 $this->stdpage->withTitle($title)->getTitle()
175 $title =
'some short title';
178 $this->stdpage->withShortTitle($title)->getShortTitle()
183 $title =
'some view title';
186 $this->stdpage->withViewTitle($title)->getViewTitle()
192 $this->assertEquals(
"ltr", $this->stdpage->getTextDirection());
196 ->withTextDirection($this->stdpage::RTL)
203 $meta_datum_key =
'meta_datum_key';
204 $meta_datum_value =
'meta_datum_value';
205 $meta_data = [$meta_datum_key => $meta_datum_value];
208 $this->stdpage->withAdditionalMetaDatum($meta_datum_key, $meta_datum_value)->getMetaData()
214 $this->stdpage = $this->stdpage
216 ->withViewTitle(
"View Title")
217 ->withShortTitle(
"Short Title");
224 <html lang="en" dir="ltr"> 226 <meta charset="utf-8" /> 227 <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 228 <meta name="viewport" content="width=device-width, initial-scale=1" /> 229 <title>Short Title: View Title</title> 233 <div class="il-layout-page"> 235 <div class="header-inner"> 236 <div class="il-logo"> 237 <span class="hidden-xs">Logo Stub</span> 238 <span class="visible-xs">Responsive Logo Stub</span> 239 <div class="il-pagetitle">Title</div> 243 <div class="breadcrumbs"></div> 244 <div class="il-system-infos"></div> 245 <div class="nav il-maincontrols">MainBar Stub</div> 246 <!-- html5 main-tag is not supported in IE / div is needed --> 247 <main class="il-layout-page-content"> 248 <div>some content</div> 251 <script>il.Util.addOnLoad(function() {});</script> 254 $this->assertEquals($exptected, $html);
259 $this->stdpage = $this->stdpage->withAdditionalMetaDatum(
'meta_datum_key_1',
'meta_datum_value_1');
260 $this->stdpage = $this->stdpage->withAdditionalMetaDatum(
'meta_datum_key_2',
'meta_datum_value_2');
266 <html lang="en" dir="ltr"> 268 <meta charset="utf-8" /> 269 <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 270 <meta name="viewport" content="width=device-width, initial-scale=1" /> 273 <meta name="meta_datum_key_1" content="meta_datum_value_1" /> 274 <meta name="meta_datum_key_2" content="meta_datum_value_2" /> 277 <div class="il-layout-page"> 279 <div class="header-inner"> 280 <div class="il-logo"><span class="hidden-xs">Logo Stub</span><span class="visible-xs">Responsive Logo Stub</span> 281 <div class="il-pagetitle">pagetitle</div> 285 <div class="breadcrumbs"></div> 286 <div class="il-system-infos"></div> 287 <div class="nav il-maincontrols">MainBar Stub</div> 288 <!-- html5 main-tag is not supported in IE / div is needed --> 289 <main class="il-layout-page-content"> 290 <div>some content</div> 293 <script>il.Util.addOnLoad(function() {});</script> 296 $this->assertEquals($expected, $html);
301 $this->stdpage = $this->stdpage->withTextDirection($this->stdpage::RTL);
308 <html lang="en" dir="rtl"> 310 <meta charset="utf-8" /> 311 <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 312 <meta name="viewport" content="width=device-width, initial-scale=1" /> 317 <div class="il-layout-page"> 319 <div class="header-inner"> 320 <div class="il-logo"> 321 <span class="hidden-xs">Logo Stub</span> 322 <span class="visible-xs">Responsive Logo Stub</span> 323 <div class="il-pagetitle">pagetitle</div> 327 <div class="breadcrumbs"></div> 328 <div class="il-system-infos"></div> 329 <div class="nav il-maincontrols">MainBar Stub</div> 330 <!-- html5 main-tag is not supported in IE / div is needed --> 331 <main class="il-layout-page-content"> 332 <div>some content</div> 335 <script>il.Util.addOnLoad(function() {});</script> 338 $this->assertEquals($exptected, $html);
This describes the Legacy-Slate.
testRenderingWithMetaData()
Tests for the Standard Page.
Provides common functionality for UI tests.
brutallyTrimHTML($html)
A more radical version of normalizeHTML.
getDefaultRenderer(JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
testRenderingWithRtlLanguage()