ILIAS  release_8 Revision v8.24
PanelSecondaryLegacyTest Class Reference

Test secondary legacy panels. More...

+ Inheritance diagram for PanelSecondaryLegacyTest:
+ Collaboration diagram for PanelSecondaryLegacyTest:

Public Member Functions

 getUIFactory ()
 
 test_implements_factory_interface ()
 
 test_get_title ()
 
 test_get_legacy_component ()
 
 test_with_actions ()
 
 test_without_viewcontrols ()
 
 test_with_sortation_viewcontrol ()
 
 test_with_pagination_viewcontrol ()
 
 test_with_section_viewcontrol ()
 
 test_render_with_actions ()
 
 test_render_with_sortation ()
 
 test_render_with_pagination ()
 
 test_render_with_section ()
 
 test_render_with_footer ()
 
 test_render_with_no_header ()
 
- 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)
 

Protected Member Functions

 cleanHTML (string $html)
 
- 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

Test secondary legacy panels.

Definition at line 31 of file PanelSecondaryLegacyTest.php.

Member Function Documentation

◆ cleanHTML()

PanelSecondaryLegacyTest::cleanHTML ( string  $html)
protected

Definition at line 73 of file PanelSecondaryLegacyTest.php.

73 : string
74 {
75 $html = str_replace(["\n", "\t"], "", $html);
76
77 return trim($html);
78 }

Referenced by test_render_with_actions(), test_render_with_footer(), test_render_with_no_header(), test_render_with_pagination(), test_render_with_section(), and test_render_with_sortation().

+ Here is the caller graph for this function:

◆ getUIFactory()

PanelSecondaryLegacyTest::getUIFactory ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 33 of file PanelSecondaryLegacyTest.php.

34 {
35 return new class () extends NoUIFactory {
36 public function legacyPanel(string $title, C\Legacy\Legacy $content): I\Component\Panel\Secondary\Legacy
37 {
38 return new I\Component\Panel\Secondary\Legacy($title, $content);
39 }
40
41 public function legacy(string $content): C\Legacy\Legacy
42 {
43 $f = new I\Component\Legacy\Factory(new I\Component\SignalGenerator());
44 return $f->legacy($content);
45 }
46
47 public function dropdown(): C\Dropdown\Factory
48 {
49 return new I\Component\Dropdown\Factory();
50 }
51
52 public function viewControl(): C\ViewControl\Factory
53 {
54 return new I\Component\ViewControl\Factory(new SignalGenerator());
55 }
56
57 public function button(): C\Button\Factory
58 {
59 return new I\Component\Button\Factory();
60 }
61
62 public function symbol(): C\Symbol\Factory
63 {
64 return new I\Component\Symbol\Factory(
65 new I\Component\Symbol\Icon\Factory(),
66 new I\Component\Symbol\Glyph\Factory(),
67 new I\Component\Symbol\Avatar\Factory()
68 );
69 }
70 };
71 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References Vendor\Package\$f, and ILIAS\UI\examples\MainControls\Slate\Legacy\legacy().

Referenced by test_get_legacy_component(), test_get_title(), test_implements_factory_interface(), test_render_with_actions(), test_render_with_footer(), test_render_with_no_header(), test_render_with_pagination(), test_render_with_section(), test_render_with_sortation(), test_with_actions(), test_with_pagination_viewcontrol(), test_with_section_viewcontrol(), test_with_sortation_viewcontrol(), and test_without_viewcontrols().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_get_legacy_component()

PanelSecondaryLegacyTest::test_get_legacy_component ( )

Definition at line 96 of file PanelSecondaryLegacyTest.php.

96 : void
97 {
98 $legacy = $this->getUIFactory()->legacy("Legacy content");
99 $secondary_panel = $this->getUIFactory()->legacyPanel("title", $legacy);
100
101 $this->assertEquals($secondary_panel->getLegacyComponent(), $legacy);
102 }

References getUIFactory().

+ Here is the call graph for this function:

◆ test_get_title()

PanelSecondaryLegacyTest::test_get_title ( )

Definition at line 88 of file PanelSecondaryLegacyTest.php.

88 : void
89 {
90 $legacy = $this->getUIFactory()->legacy("Legacy content");
91 $secondary_panel = $this->getUIFactory()->legacyPanel("Title", $legacy);
92
93 $this->assertEquals("Title", $secondary_panel->getTitle());
94 }

References getUIFactory().

+ Here is the call graph for this function:

◆ test_implements_factory_interface()

PanelSecondaryLegacyTest::test_implements_factory_interface ( )

Definition at line 80 of file PanelSecondaryLegacyTest.php.

80 : void
81 {
82 $legacy = $this->getUIFactory()->legacy("Legacy content");
83 $secondary_panel = $this->getUIFactory()->legacyPanel("List Title", $legacy);
84
85 $this->assertInstanceOf("ILIAS\\UI\\Component\\Panel\\Secondary\\Legacy", $secondary_panel);
86 }

References getUIFactory().

+ Here is the call graph for this function:

◆ test_render_with_actions()

PanelSecondaryLegacyTest::test_render_with_actions ( )

Definition at line 180 of file PanelSecondaryLegacyTest.php.

180 : void
181 {
182 $legacy = $this->getUIFactory()->legacy("Legacy content");
183 $actions = $this->getUIFactory()->dropdown()->standard(array(
184 $this->getUIFactory()->button()->shy("ILIAS", "https://www.ilias.de"),
185 $this->getUIFactory()->button()->shy("Github", "https://www.github.com")
186 ));
187
188 $sec = $this->getUIFactory()->legacyPanel("Title", $legacy)->withActions($actions);
189
190 $html = $this->getDefaultRenderer()->render($sec);
191
192 $expected_html = <<<EOT
193<div class="panel panel-secondary panel-flex">
194 <div class="panel-heading ilHeader">
195 <h2>Title</h2>
196 <div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" id="id_3" aria-label="actions" aria-haspopup="true" aria-expanded="false" aria-controls="id_3_menu" > <span class="caret"></span></button>
197 <ul id="id_3_menu" class="dropdown-menu">
198 <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
199 <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">Github</button></li>
200 </ul>
201 </div>
202 </div>
203 <div class="panel-body">
204 Legacy content
205 </div>
206</div>
207EOT;
208 $this->assertHTMLEquals(
209 $this->cleanHTML($expected_html),
210 $this->cleanHTML($html)
211 );
212 }
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
Title class.
Definition: Title.php:27
Class ChatMainBarProvider \MainMenu\Provider.

References ILIAS_UI_TestBase\assertHTMLEquals(), cleanHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getUIFactory().

+ Here is the call graph for this function:

◆ test_render_with_footer()

PanelSecondaryLegacyTest::test_render_with_footer ( )

Definition at line 342 of file PanelSecondaryLegacyTest.php.

342 : void
343 {
344 $legacy = $this->getUIFactory()->legacy("Legacy content");
345 $footer_shy_button = $this->getUIFactory()->button()->shy("Action", "");
346
347 $secondary_panel = $this->getUIFactory()->legacyPanel("Title", $legacy)
348 ->withFooter($footer_shy_button);
349
350 $html = $this->getDefaultRenderer()->render($secondary_panel);
351
352 $expected_html = <<<EOT
353<div class="panel panel-secondary panel-flex">
354 <div class="panel-heading ilHeader">
355 <h2>Title</h2>
356 </div>
357 <div class="panel-body">
358 Legacy content
359 </div>
360 <div class="panel-footer ilBlockInfo">
361 <button class="btn btn-link" data-action="">Action</button>
362 </div>
363</div>
364EOT;
365 $this->assertHTMLEquals(
366 $this->cleanHTML($expected_html),
367 $this->cleanHTML($html)
368 );
369 }

References ILIAS_UI_TestBase\assertHTMLEquals(), cleanHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getUIFactory().

+ Here is the call graph for this function:

◆ test_render_with_no_header()

PanelSecondaryLegacyTest::test_render_with_no_header ( )

Definition at line 371 of file PanelSecondaryLegacyTest.php.

371 : void
372 {
373 $legacy = $this->getUIFactory()->legacy("Legacy content");
374
375 $secondary_panel = $this->getUIFactory()->legacyPanel("", $legacy);
376
377 $html = $this->getDefaultRenderer()->render($secondary_panel);
378
379 $expected_html = <<<EOT
380<div class="panel panel-secondary panel-flex">
381 <div class="panel-body">
382 Legacy content
383 </div>
384</div>
385EOT;
386 $this->assertHTMLEquals(
387 $this->cleanHTML($expected_html),
388 $this->cleanHTML($html)
389 );
390 }

References ILIAS_UI_TestBase\assertHTMLEquals(), cleanHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getUIFactory().

+ Here is the call graph for this function:

◆ test_render_with_pagination()

PanelSecondaryLegacyTest::test_render_with_pagination ( )

Definition at line 254 of file PanelSecondaryLegacyTest.php.

254 : void
255 {
256 $legacy = $this->getUIFactory()->legacy("Legacy content");
257
258 $pagination = $this->getUIFactory()->viewControl()->pagination()
259 ->withTargetURL('http://ilias.de', 'page')
260 ->withTotalEntries(10)
261 ->withPageSize(2)
262 ->withCurrentPage(1);
263
264 $sec = $this->getUIFactory()->legacyPanel("Title", $legacy)
265 ->withViewControls([$pagination]);
266
267 $html = $this->getDefaultRenderer()->render($sec);
268
269 $expected_html = <<<EOT
270<div class="panel panel-secondary panel-flex">
271 <div class="panel-heading ilHeader">
272 <h2>Title</h2>
273 <div class="il-viewcontrol-pagination">
274 <span class="browse previous">
275 <a tabindex="0" class="glyph" href="http://ilias.de?page=0" aria-label="back">
276 <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
277 </a>
278 </span>
279 <button class="btn btn-link" data-action="http://ilias.de?page=0" id="id_1">1</button>
280 <button class="btn btn-link engaged" aria-pressed="true" data-action="http://ilias.de?page=1" id="id_2">2</button>
281 <button class="btn btn-link" data-action="http://ilias.de?page=2" id="id_3">3</button>
282 <button class="btn btn-link" data-action="http://ilias.de?page=3" id="id_4">4</button>
283 <button class="btn btn-link" data-action="http://ilias.de?page=4" id="id_5">5</button>
284 <span class="browse next">
285 <a tabindex="0" class="glyph" href="http://ilias.de?page=2" aria-label="next">
286 <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
287 </a>
288 </span>
289 </div>
290 </div>
291 <div class="panel-body">
292 Legacy content
293 </div>
294</div>
295EOT;
296 $this->assertHTMLEquals(
297 $this->cleanHTML($expected_html),
298 $this->cleanHTML($html)
299 );
300 }

References ILIAS_UI_TestBase\assertHTMLEquals(), cleanHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getUIFactory().

+ Here is the call graph for this function:

◆ test_render_with_section()

PanelSecondaryLegacyTest::test_render_with_section ( )

Definition at line 302 of file PanelSecondaryLegacyTest.php.

302 : void
303 {
304 $legacy = $this->getUIFactory()->legacy("Legacy content");
305 $back = $this->getUIFactory()->button()->standard("previous", "http://www.ilias.de");
306 $next = $this->getUIFactory()->button()->standard("next", "http://www.github.com");
307 $current = $this->getUIFactory()->button()->standard("current", "");
308 $section = $this->getUIFactory()->viewControl()->section($back, $current, $next);
309
310 $secondary_panel = $this->getUIFactory()->legacyPanel("Title", $legacy)
311 ->withViewControls([$section]);
312
313 $html = $this->getDefaultRenderer()->render($secondary_panel);
314
315 $expected_html = <<<EOT
316<div class="panel panel-secondary panel-flex">
317 <div class="panel-heading ilHeader">
318 <h2>Title</h2>
319 <div class="il-viewcontrol-section">
320 <a class="btn btn-default " href="http://www.ilias.de" aria-label="previous" data-action="http://www.ilias.de" id="id_1">
321 <span class="glyphicon glyphicon-chevron-left"></span>
322 </a>
323 <button class="btn btn-default" data-action="">
324 current
325 </button>
326 <a class="btn btn-default " href="http://www.github.com" aria-label="next" data-action="http://www.github.com" id="id_2">
327 <span class="glyphicon glyphicon-chevron-right"></span>
328 </a>
329 </div>
330 </div>
331 <div class="panel-body">
332 Legacy content
333 </div>
334</div>
335EOT;
336 $this->assertHTMLEquals(
337 $this->cleanHTML($expected_html),
338 $this->cleanHTML($html)
339 );
340 }

References ILIAS_UI_TestBase\assertHTMLEquals(), cleanHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getUIFactory().

+ Here is the call graph for this function:

◆ test_render_with_sortation()

PanelSecondaryLegacyTest::test_render_with_sortation ( )

Definition at line 214 of file PanelSecondaryLegacyTest.php.

214 : void
215 {
216 $legacy = $this->getUIFactory()->legacy("Legacy content");
217 $sort_options = array(
218 'a' => 'A',
219 'b' => 'B'
220 );
221 $sortation = $this->getUIFactory()->viewControl()->sortation($sort_options);
222 $sec = $this->getUIFactory()->legacyPanel("Title", $legacy)
223 ->withViewControls([$sortation]);
224
225 $html = $this->getDefaultRenderer()->render($sec);
226
227 $expected_html = <<<EOT
228<div class="panel panel-secondary panel-flex">
229 <div class="panel-heading ilHeader">
230 <h2>Title</h2>
231 <div class="il-viewcontrol-sortation" id="id_1">
232 <div class="dropdown">
233 <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" id="id_4" aria-label="actions" aria-haspopup="true" aria-expanded="false" aria-controls="id_4_menu">
234 <span class="caret"></span>
235 </button>
236 <ul id="id_4_menu" class="dropdown-menu">
237 <li><button class="btn btn-link" data-action="?sortation=a" id="id_2">A</button></li>
238 <li><button class="btn btn-link" data-action="?sortation=b" id="id_3">B</button></li>
239 </ul>
240 </div>
241 </div>
242 </div>
243 <div class="panel-body">
244 Legacy content
245 </div>
246</div>
247EOT;
248 $this->assertHTMLEquals(
249 $this->cleanHTML($expected_html),
250 $this->cleanHTML($html)
251 );
252 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Breadcrumbs.php:21
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Avatar.php:21

References ILIAS_UI_TestBase\assertHTMLEquals(), cleanHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getUIFactory().

+ Here is the call graph for this function:

◆ test_with_actions()

PanelSecondaryLegacyTest::test_with_actions ( )

Definition at line 104 of file PanelSecondaryLegacyTest.php.

104 : void
105 {
106 $legacy = $this->getUIFactory()->legacy("Legacy content");
107 $actions = $this->getUIFactory()->dropdown()->standard(array(
108 $this->getUIFactory()->button()->shy("ILIAS", "https://www.ilias.de"),
109 $this->getUIFactory()->button()->shy("Github", "https://www.github.com")
110 ));
111
112 $secondary_panel = $this->getUIFactory()->legacyPanel("title", $legacy)
113 ->withActions($actions);
114
115 $this->assertEquals($secondary_panel->getActions(), $actions);
116 }

References getUIFactory().

+ Here is the call graph for this function:

◆ test_with_pagination_viewcontrol()

PanelSecondaryLegacyTest::test_with_pagination_viewcontrol ( )

Definition at line 145 of file PanelSecondaryLegacyTest.php.

145 : void
146 {
147 $legacy = $this->getUIFactory()->legacy("Legacy content");
148 $pagination = $this->getUIFactory()->viewControl()->pagination()
149 ->withTargetURL("http://ilias.de", 'page')
150 ->withTotalEntries(98)
151 ->withPageSize(10)
152 ->withCurrentPage(1);
153
154 $secondary_panel = $this->getUIFactory()->legacyPanel("title", $legacy)
155 ->withViewControls([$pagination]);
156
157 $array_vc = $secondary_panel->getViewControls();
158
159 $this->assertEquals($array_vc[0], $pagination);
160 }

References getUIFactory().

+ Here is the call graph for this function:

◆ test_with_section_viewcontrol()

PanelSecondaryLegacyTest::test_with_section_viewcontrol ( )

Definition at line 162 of file PanelSecondaryLegacyTest.php.

162 : void
163 {
164 $legacy = $this->getUIFactory()->legacy("Legacy content");
165 $back = $this->getUIFactory()->button()->standard("previous", "http://www.ilias.de");
166 $next = $this->getUIFactory()->button()->standard("next", "http://www.github.com");
167 $current = $this->getUIFactory()->button()->standard("current", "");
168 $section = $this->getUIFactory()->viewControl()->section($back, $current, $next);
169
170 $secondary_panel = $this->getUIFactory()->legacyPanel("title", $legacy)
171 ->withViewControls([$section]);
172
173 $array_vc = $secondary_panel->getViewControls();
174
175 $this->assertEquals($array_vc[0], $section);
176 }

References getUIFactory().

+ Here is the call graph for this function:

◆ test_with_sortation_viewcontrol()

PanelSecondaryLegacyTest::test_with_sortation_viewcontrol ( )

Definition at line 127 of file PanelSecondaryLegacyTest.php.

127 : void
128 {
129 $legacy = $this->getUIFactory()->legacy("Legacy content");
130 $sort_options = array(
131 'internal_rating' => 'Best',
132 'date_desc' => 'Most Recent',
133 'date_asc' => 'Oldest',
134 );
135 $sortation = $this->getUIFactory()->viewControl()->sortation($sort_options);
136
137 $secondary_panel = $this->getUIFactory()->legacyPanel("title", $legacy)
138 ->withViewControls([$sortation]);
139
140 $array_vc = $secondary_panel->getViewControls();
141
142 $this->assertEquals($array_vc[0], $sortation);
143 }

References getUIFactory().

+ Here is the call graph for this function:

◆ test_without_viewcontrols()

PanelSecondaryLegacyTest::test_without_viewcontrols ( )

Definition at line 118 of file PanelSecondaryLegacyTest.php.

118 : void
119 {
120 $legacy = $this->getUIFactory()->legacy("Legacy content");
121 $secondary_panel = $this->getUIFactory()->legacyPanel("title", $legacy);
122 $array_vc = $secondary_panel->getViewControls();
123
124 $this->assertEquals(null, $array_vc);
125 }

References getUIFactory().

+ Here is the call graph for this function:

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