ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
CounterClientHtmlTest Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for CounterClientHtmlTest:
+ Collaboration diagram for CounterClientHtmlTest:

Public Member Functions

 getGlyphFactory ()
 
 getCounterFactory ()
 
 testRenderClientHtml ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 getHelpTextRetriever ()
 
 getUploadLimitResolver ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML (string $html)
 
 assertHTMLEquals (string $expected_html_as_string, string $html_as_string)
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML (string $html)
 A more radical version of normalizeHTML. More...
 
 brutallyTrimSignals (string $html)
 A naive replacement of all il_signal-ids with dots to ease comparisons of rendered output. More...
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Checks if the HTML used for the Client tests is rendered as specified

Definition at line 28 of file CounterClientHtmlTest.php.

Member Function Documentation

◆ getCounterFactory()

CounterClientHtmlTest::getCounterFactory ( )

Definition at line 35 of file CounterClientHtmlTest.php.

Referenced by testRenderClientHtml().

36  {
37  return new \ILIAS\UI\Implementation\Component\Counter\Factory();
38  }
+ Here is the caller graph for this function:

◆ getGlyphFactory()

CounterClientHtmlTest::getGlyphFactory ( )

Definition at line 30 of file CounterClientHtmlTest.php.

Referenced by testRenderClientHtml().

31  {
32  return new \ILIAS\UI\Implementation\Component\Symbol\Glyph\Factory();
33  }
This is how the factory for UI elements looks.
Definition: Factory.php:37
+ Here is the caller graph for this function:

◆ testRenderClientHtml()

CounterClientHtmlTest::testRenderClientHtml ( )

Definition at line 40 of file CounterClientHtmlTest.php.

References $r, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), getCounterFactory(), ILIAS_UI_TestBase\getDefaultRenderer(), and getGlyphFactory().

40  : 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  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:458
$r
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: