ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
CounterClientHtmlTest.php
Go to the documentation of this file.
1<?php
2
19require_once("vendor/composer/vendor/autoload.php");
20
21require_once(__DIR__ . "/../../Base.php");
22
24
29{
30 public function getGlyphFactory(): \ILIAS\UI\Implementation\Component\Symbol\Glyph\Factory
31 {
32 return new \ILIAS\UI\Implementation\Component\Symbol\Glyph\Factory();
33 }
34
35 public function getCounterFactory(): \ILIAS\UI\Implementation\Component\Counter\Factory
36 {
37 return new \ILIAS\UI\Implementation\Component\Counter\Factory();
38 }
39
40 public function testRenderClientHtml(): void
41 {
42 $counter_factory = $this->getCounterFactory();
43 $expected_html = file_get_contents(__DIR__ . "/../../Client/Counter/CounterTest.html");
44
45 $rendered_html = '
46 <div>
47 <div id="testEmpty">
48 </div>
49 <div id="test1">
50 RENDERED_HTML_OF_TEST_1
51 </div>
52
53 <div id="test2">
54 RENDERED_HTML_OF_TEST_2
55 </div>
56 </div>';
57
58
59 $add_glpyh = $this->getGlyphFactory()->add("");
60 $glyph_with_counter = $add_glpyh->withCounter($counter_factory->status(1))
61 ->withCounter($counter_factory->novelty(5));
62
63 $r = $this->getDefaultRenderer();
64 $rendered_html_of_test_1 = $r->render($glyph_with_counter);
65 $rendered_html_of_test_2 = $rendered_html_of_test_1 . $rendered_html_of_test_1;
66
67 $rendered_html = str_replace("RENDERED_HTML_OF_TEST_1", $rendered_html_of_test_1, $rendered_html);
68 $rendered_html = str_replace("RENDERED_HTML_OF_TEST_2", $rendered_html_of_test_2, $rendered_html);
69
70 $this->assertHTMLEquals($this->brutallyTrimHTML($expected_html), $this->brutallyTrimHTML($rendered_html));
71 }
72}
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:337
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.