ILIAS  release_8 Revision v8.25
CounterClientHtmlTest.php
Go to the documentation of this file.
1<?php
18require_once("libs/composer/vendor/autoload.php");
19
20require_once(__DIR__ . "/../../Base.php");
21
23
28{
29 public function getGlyphFactory(): \ILIAS\UI\Implementation\Component\Symbol\Glyph\Factory
30 {
31 return new \ILIAS\UI\Implementation\Component\Symbol\Glyph\Factory();
32 }
33
34 public function getCounterFactory(): \ILIAS\UI\Implementation\Component\Counter\Factory
35 {
36 return new \ILIAS\UI\Implementation\Component\Counter\Factory();
37 }
38
39 public function testRenderClientHtml(): void
40 {
41 $counter_factory = $this->getCounterFactory();
42 $expected_html = file_get_contents(__DIR__ . "/../../Client/Counter/CounterTest.html");
43
44 $rendered_html = '
45 <div>
46 <div id="testEmpty">
47 </div>
48 <div id="test1">
49 RENDERED_HTML_OF_TEST_1
50 </div>
51
52 <div id="test2">
53 RENDERED_HTML_OF_TEST_2
54 </div>
55 </div>';
56
57
58 $add_glpyh = $this->getGlyphFactory()->add("");
59 $glyph_with_counter = $add_glpyh->withCounter($counter_factory->status(1))
60 ->withCounter($counter_factory->novelty(5));
61
62 $r = $this->getDefaultRenderer();
63 $rendered_html_of_test_1 = $r->render($glyph_with_counter);
64 $rendered_html_of_test_2 = $rendered_html_of_test_1 . $rendered_html_of_test_1;
65
66 $rendered_html = str_replace("RENDERED_HTML_OF_TEST_1", $rendered_html_of_test_1, $rendered_html);
67 $rendered_html = str_replace("RENDERED_HTML_OF_TEST_2", $rendered_html_of_test_2, $rendered_html);
68
69 $this->assertHTMLEquals($this->brutallyTrimHTML($expected_html), $this->brutallyTrimHTML($rendered_html));
70 }
71}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Provides common functionality for UI tests.
Definition: Base.php:299
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
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...
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.