ILIAS  release_8 Revision v8.24
SystemInfoTest Class Reference

Class SystemInfoTest. More...

+ Inheritance diagram for SystemInfoTest:
+ Collaboration diagram for SystemInfoTest:

Public Member Functions

 setUp ()
 
 testRenderingDefault ()
 
 testRenderingNeutral ()
 
 testRenderingImportant ()
 
 testRenderingBreaking ()
 
 testRenderingCloseAction ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
 
 getUIFactory ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 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)
 

Private Attributes

SignalGenerator $sig_gen
 

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

Class SystemInfoTest.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 35 of file SystemInfoTest.php.

Member Function Documentation

◆ getDefaultRenderer()

SystemInfoTest::getDefaultRenderer ( JavaScriptBinding  $js_binding = null,
array  $with_stub_renderings = [] 
)

Reimplemented from ILIAS_UI_TestBase.

Definition at line 210 of file SystemInfoTest.php.

214 return parent::getDefaultRenderer(new class () implements JavaScriptBinding {
215 public function createId(): string
216 {
217 return "id";
218 }
219
220 public array $on_load_code = array();
221
222 public function addOnLoadCode(string $code): void
223 {
224 $this->on_load_code[] = $code;
225 }
226
227 public function getOnLoadCodeAsync(): string
228 {
229 }
230 });
231 }
Provides methods to interface with javascript.

Referenced by testRenderingBreaking(), testRenderingCloseAction(), testRenderingDefault(), testRenderingImportant(), and testRenderingNeutral().

+ Here is the caller graph for this function:

◆ getUIFactory()

SystemInfoTest::getUIFactory ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 233 of file SystemInfoTest.php.

234 {
235 $factory = new class () extends NoUIFactory {
237
238 public function __construct()
239 {
240 $this->sig_gen = new SignalGenerator();
241 }
242
243 public function symbol(): ILIAS\UI\Component\Symbol\Factory
244 {
245 return new Factory(
246 new \ILIAS\UI\Implementation\Component\Symbol\Icon\Factory(),
247 new \ILIAS\UI\Implementation\Component\Symbol\Glyph\Factory(),
248 new \ILIAS\UI\Implementation\Component\Symbol\Avatar\Factory()
249 );
250 }
251
252 public function mainControls(): \ILIAS\UI\Component\MainControls\Factory
253 {
254 return new \ILIAS\UI\Implementation\Component\MainControls\Factory(
255 $this->sig_gen,
256 new \ILIAS\UI\Implementation\Component\MainControls\Slate\Factory(
257 $this->sig_gen,
258 new \ILIAS\UI\Implementation\Component\Counter\Factory(),
259 $this->symbol()
260 )
261 );
262 }
263 };
264 $factory->sig_gen = $this->sig_gen;
265
266 return $factory;
267 }
SignalGenerator $sig_gen
$factory
Definition: metadata.php:75
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.

References $factory, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

◆ setUp()

SystemInfoTest::setUp ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 39 of file SystemInfoTest.php.

39 : void
40 {
41 parent::setUp();
42 $this->sig_gen = new SignalGenerator();
43 }

◆ testRenderingBreaking()

SystemInfoTest::testRenderingBreaking ( )

Definition at line 142 of file SystemInfoTest.php.

142 : void
143 {
144 $headline = 'That\'s one small step for [a] man';
145 $information = 'Lorem IPsum dolor sit amet';
146 $r = $this->getDefaultRenderer();
147 $system_info = (new SystemInfo($this->sig_gen, $headline, $information))
148 ->withDenotation(SystemInfoAlias::DENOTATION_BREAKING);
149
150 // Breaking
151 $expected = <<<EOT
152<div id="id" class="container-fluid il-system-info il-system-info-breaking" data-close-uri="" role="alert" aria-labelledby="id_headline" aria-describedby="id_description">
153 <div class="il-system-info-content-wrapper">
154 <div class="il-system-info-content">
155 <span id="id_headline" class="il-system-info-headline">$headline</span>
156 <span id="id_description" class="il-system-info-body">$information</span>
157 </div>
158 </div>
159 <div class="il-system-info-actions">
160 <span class="il-system-info-more">
161 <a tabindex="0" class="glyph" href="#" aria-label="show_more"><span class="glyphicon glyphicon-option-horizontal" aria-hidden="true"></span></a>
162 </span>
163 <span class="il-system-info-close"></span>
164 </div>
165</div>
166EOT;
167
168 $actual = $r->render($system_info);
169 $this->assertEquals(
170 $this->brutallyTrimHTML($expected),
171 $this->brutallyTrimHTML($actual)
172 );
173 }
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])

References ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS\UI\examples\Symbol\Glyph\Close\close(), and getDefaultRenderer().

+ Here is the call graph for this function:

◆ testRenderingCloseAction()

SystemInfoTest::testRenderingCloseAction ( )

Definition at line 176 of file SystemInfoTest.php.

176 : void
177 {
178 $headline = 'That\'s one small step for [a] man';
179 $information = 'Lorem IPsum dolor sit amet';
180 $uri_string = 'http://one_giant_leap?for=mankind';
181 $action = new URI($uri_string);
182 $r = $this->getDefaultRenderer();
183 $system_info = (new SystemInfo($this->sig_gen, $headline, $information))
184 ->withDismissAction($action);
185
186 $expected = <<<EOT
187<div id="id" class="container-fluid il-system-info il-system-info-neutral" data-close-uri="$uri_string" aria-live="polite" aria-labelledby="id_headline" aria-describedby="id_description">
188 <div class="il-system-info-content-wrapper">
189 <div class="il-system-info-content">
190 <span id="id_headline" class="il-system-info-headline">$headline</span>
191 <span id="id_description" class="il-system-info-body">$information</span>
192 </div>
193 </div>
194 <div class="il-system-info-actions">
195 <span class="il-system-info-more">
196 <a tabindex="0" class="glyph" href="#" aria-label="show_more"><span class="glyphicon glyphicon-option-horizontal" aria-hidden="true"></span></a>
197 </span>
198 <span class="il-system-info-close"><a tabindex="0" class="glyph" href="#" aria-label="close" id="id"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a></span>
199 </div>
200</div>
201EOT;
202
203 $actual = $r->render($system_info);
204 $this->assertEquals(
205 $this->brutallyTrimHTML($expected),
206 $this->brutallyTrimHTML($actual)
207 );
208 }
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35

References ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS\UI\examples\Symbol\Glyph\Close\close(), and getDefaultRenderer().

+ Here is the call graph for this function:

◆ testRenderingDefault()

SystemInfoTest::testRenderingDefault ( )

Definition at line 45 of file SystemInfoTest.php.

45 : void
46 {
47 $headline = 'That\'s one small step for [a] man';
48 $information = 'Lorem IPsum dolor sit amet';
49 $r = $this->getDefaultRenderer();
50 $system_info = new SystemInfo($this->sig_gen, $headline, $information);
51
52 // Neutral
53 $expected = <<<EOT
54<div id="id" class="container-fluid il-system-info il-system-info-neutral" data-close-uri="" aria-live="polite" aria-labelledby="id_headline" aria-describedby="id_description">
55 <div class="il-system-info-content-wrapper">
56 <div class="il-system-info-content">
57 <span id="id_headline" class="il-system-info-headline">$headline</span>
58 <span id="id_description" class="il-system-info-body">$information</span>
59 </div>
60 </div>
61 <div class="il-system-info-actions">
62 <span class="il-system-info-more">
63 <a tabindex="0" class="glyph" href="#" aria-label="show_more"><span class="glyphicon glyphicon-option-horizontal" aria-hidden="true"></span></a>
64 </span>
65 <span class="il-system-info-close"></span>
66 </div>
67</div>
68EOT;
69
70 $actual = $r->render($system_info);
71 $this->assertEquals(
72 $this->brutallyTrimHTML($expected),
73 $this->brutallyTrimHTML($actual)
74 );
75 }

References ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS\UI\examples\Symbol\Glyph\Close\close(), and getDefaultRenderer().

+ Here is the call graph for this function:

◆ testRenderingImportant()

SystemInfoTest::testRenderingImportant ( )

Definition at line 110 of file SystemInfoTest.php.

110 : void
111 {
112 $headline = 'That\'s one small step for [a] man';
113 $information = 'Lorem IPsum dolor sit amet';
114 $r = $this->getDefaultRenderer();
115 $system_info = (new SystemInfo($this->sig_gen, $headline, $information))
116 ->withDenotation(SystemInfoAlias::DENOTATION_IMPORTANT);
117
118 $actual = $r->render($system_info);
119 $expected = <<<EOT
120<div id="id" class="container-fluid il-system-info il-system-info-important" data-close-uri="" aria-live="polite" aria-labelledby="id_headline" aria-describedby="id_description">
121 <div class="il-system-info-content-wrapper">
122 <div class="il-system-info-content">
123 <span id="id_headline" class="il-system-info-headline">$headline</span>
124 <span id="id_description" class="il-system-info-body">$information</span>
125 </div>
126 </div>
127 <div class="il-system-info-actions">
128 <span class="il-system-info-more">
129 <a tabindex="0" class="glyph" href="#" aria-label="show_more"><span class="glyphicon glyphicon-option-horizontal" aria-hidden="true"></span></a>
130 </span>
131 <span class="il-system-info-close"></span>
132 </div>
133</div>
134EOT;
135
136 $this->assertEquals(
137 $this->brutallyTrimHTML($expected),
138 $this->brutallyTrimHTML($actual)
139 );
140 }

References ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS\UI\examples\Symbol\Glyph\Close\close(), and getDefaultRenderer().

+ Here is the call graph for this function:

◆ testRenderingNeutral()

SystemInfoTest::testRenderingNeutral ( )

Definition at line 77 of file SystemInfoTest.php.

77 : void
78 {
79 $headline = 'That\'s one small step for [a] man';
80 $information = 'Lorem IPsum dolor sit amet';
81 $r = $this->getDefaultRenderer();
82 $system_info = (new SystemInfo($this->sig_gen, $headline, $information))
83 ->withDenotation(SystemInfoAlias::DENOTATION_NEUTRAL);
84
85 // Neutral
86 $expected = <<<EOT
87<div id="id" class="container-fluid il-system-info il-system-info-neutral" data-close-uri="" aria-live="polite" aria-labelledby="id_headline" aria-describedby="id_description">
88 <div class="il-system-info-content-wrapper">
89 <div class="il-system-info-content">
90 <span id="id_headline" class="il-system-info-headline">$headline</span>
91 <span id="id_description" class="il-system-info-body">$information</span>
92 </div>
93 </div>
94 <div class="il-system-info-actions">
95 <span class="il-system-info-more">
96 <a tabindex="0" class="glyph" href="#" aria-label="show_more"><span class="glyphicon glyphicon-option-horizontal" aria-hidden="true"></span></a>
97 </span>
98 <span class="il-system-info-close"></span>
99 </div>
100</div>
101EOT;
102
103 $actual = $r->render($system_info);
104 $this->assertEquals(
105 $this->brutallyTrimHTML($expected),
106 $this->brutallyTrimHTML($actual)
107 );
108 }

References ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS\UI\examples\Symbol\Glyph\Close\close(), and getDefaultRenderer().

+ Here is the call graph for this function:

Field Documentation

◆ $sig_gen

SignalGenerator SystemInfoTest::$sig_gen
private

Definition at line 37 of file SystemInfoTest.php.


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