ILIAS  release_8 Revision v8.24
ToastClientHtmlTest.php
Go to the documentation of this file.
1<?php
18require_once("libs/composer/vendor/autoload.php");
19
20require_once(__DIR__ . "/../../Base.php");
21
24
26{
27 public function getUIFactory(): NoUIFactory
28 {
29 return new class () extends NoUIFactory {
30 public function button(): C\Button\Factory
31 {
32 return new I\Component\Button\Factory();
33 }
34 };
35 }
36
37 public function getToastFactory(): \ILIAS\UI\Implementation\Component\Toast\Factory
38 {
40 $this->createMock(ILIAS\UI\Implementation\Component\SignalGenerator::class)
41 );
42 }
43
44 public function getIconFactory(): \ILIAS\UI\Implementation\Component\Symbol\Icon\Factory
45 {
47 }
48
49 public function testRenderClientHtml(): void
50 {
51 $expected_html = file_get_contents(__DIR__ . "/../../Client/Toast/ToastTest.html");
52
53 $rendered_html = '<head>
54 <title>Toast Test HTML</title>
55 <script src="../../../../src/UI/templates/js/Toast/toast.js"></script>
56 <script>document.il = il</script>
57 </head>
58 <body>
59 {CONTAINER}
60 </body>';
61
62 $container = $this->getToastFactory()->container()->withAdditionalToast(
63 $this->getToastFactory()->standard(
64 'Title',
65 $this->getIconFactory()->standard('mail', 'Test')
66 )
67 ->withVanishTime(5000)
68 ->withDelayTime(500)
69 ->withDescription('Description')
70 ->withAction('https://www.ilias.de')
71 );
72
73 $rendered_html = str_replace('{CONTAINER}', $this->getDefaultRenderer()->render($container), $rendered_html);
74 $rendered_html = preg_replace('/id=".*?"/', '', $rendered_html);
75
76 $this->assertEquals($this->brutallyTrimHTML($expected_html), $this->brutallyTrimHTML($rendered_html));
77 }
78}
Provides common functionality for UI tests.
Definition: Base.php:299
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This is how the factory for UI elements looks.
Definition: Factory.php:38
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
standard()
This is an example, of how the Notification Slate is generated by assigning Notification Items to it.
Definition: standard.php:16
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.
$container
@noRector
Definition: wac.php:14