ILIAS  trunk Revision v11.0_alpha-1838-g59fc79e306b
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ToastClientHtmlTest.php
Go to the documentation of this file.
1 <?php
2 
19 require_once("vendor/composer/vendor/autoload.php");
20 
21 require_once(__DIR__ . "/../../Base.php");
22 
23 use ILIAS\UI\Component as C;
25 
27 {
28  public function getUIFactory(): NoUIFactory
29  {
30  return new class () extends NoUIFactory {
31  public function button(): I\Component\Button\Factory
32  {
33  return new I\Component\Button\Factory();
34  }
35  };
36  }
37 
38  public function getToastFactory(): \ILIAS\UI\Implementation\Component\Toast\Factory
39  {
41  $this->createMock(ILIAS\UI\Implementation\Component\SignalGenerator::class)
42  );
43  }
44 
45  public function getIconFactory(): \ILIAS\UI\Implementation\Component\Symbol\Icon\Factory
46  {
48  }
49 
50  public function testRenderClientHtml(): void
51  {
52  $expected_html = file_get_contents(__DIR__ . "/../../Client/Toast/ToastTest.html");
53 
54  $rendered_html = '<head>
55  <title>Toast Test HTML</title>
56  <script src="../../../resources/js/Toast/toast.js"></script>
57  <script>document.il = il</script>
58  </head>
59  <body>
60  {CONTAINER}
61  </body>';
62 
63  $container = $this->getToastFactory()->container()->withAdditionalToast(
64  $this->getToastFactory()->standard(
65  'Title',
66  $this->getIconFactory()->standard('mail', 'Test')
67  )
68  ->withDescription('Description')
69  ->withAction('https://www.ilias.de')
70  );
71 
72  $rendered_html = str_replace('{CONTAINER}', $this->getDefaultRenderer()->render($container), $rendered_html);
73  $rendered_html = preg_replace('/id=".*?"/', '', $rendered_html);
74 
75  $this->assertEquals($this->brutallyTrimHTML($expected_html), $this->brutallyTrimHTML($rendered_html));
76  }
77 }
button(string $caption, string $cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
standard()
description: > This is an example, of how the Notification Slate is generated by assigning Notificat...
Definition: standard.php:38
Interface Observer Contains several chained tasks and infos about them.
$container
Definition: wac.php:36