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

Test secondary listing panels. More...

+ Inheritance diagram for PanelSecondaryListingTest:
+ Collaboration diagram for PanelSecondaryListingTest:

Public Member Functions

 getUIFactory ()
 
 testImplementsFactoryInterface ()
 
 testGetTitle ()
 
 testGetItemGroups ()
 
 testWithActions ()
 
 testRenderWithActions ()
 
 testRenderWithSortation ()
 
 testRenderWithPagination ()
 
 testRenderWithSection ()
 
 testRenderWithFooter ()
 
 testRenderWithNoHeaderButContent ()
 
 testRenderWithNoHeaderNoContentNoFooter ()
 
- 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)
 

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 listing panels.

Definition at line 31 of file PanelSecondaryListingTest.php.

Member Function Documentation

◆ cleanHTML()

PanelSecondaryListingTest::cleanHTML ( string  $html)
protected

Definition at line 67 of file PanelSecondaryListingTest.php.

Referenced by testRenderWithFooter().

67  : string
68  {
69  $html = str_replace(["\n", "\t"], "", $html);
70 
71  return trim($html);
72  }
+ Here is the caller graph for this function:

◆ getUIFactory()

PanelSecondaryListingTest::getUIFactory ( )

Definition at line 33 of file PanelSecondaryListingTest.php.

References ILIAS\Repository\button(), and ILIAS\Repository\symbol().

Referenced by testGetItemGroups(), testGetTitle(), testImplementsFactoryInterface(), testRenderWithActions(), testRenderWithFooter(), testRenderWithNoHeaderButContent(), testRenderWithNoHeaderNoContentNoFooter(), testRenderWithPagination(), testRenderWithSection(), testRenderWithSortation(), and testWithActions().

33  : NoUIFactory
34  {
35  return new class () extends NoUIFactory {
36  public function panelSecondary(): I\Component\Panel\Secondary\Factory
37  {
38  return new I\Component\Panel\Secondary\Factory();
39  }
40 
41  public function dropdown(): C\Dropdown\Factory
42  {
43  return new I\Component\Dropdown\Factory();
44  }
45 
46  public function viewControl(): C\ViewControl\Factory
47  {
48  return new I\Component\ViewControl\Factory(new SignalGenerator());
49  }
50 
51  public function button(): C\Button\Factory
52  {
53  return new I\Component\Button\Factory();
54  }
55 
56  public function symbol(): C\Symbol\Factory
57  {
58  return new I\Component\Symbol\Factory(
59  new I\Component\Symbol\Icon\Factory(),
60  new I\Component\Symbol\Glyph\Factory(),
61  new I\Component\Symbol\Avatar\Factory()
62  );
63  }
64  };
65  }
button(string $caption, string $cmd)
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...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ testGetItemGroups()

PanelSecondaryListingTest::testGetItemGroups ( )

Definition at line 107 of file PanelSecondaryListingTest.php.

References Vendor\Package\$c, getUIFactory(), and ILIAS\UI\Implementation\Component\Input\Group.

107  : void
108  {
109  $groups = array(
110  new I\Component\Item\Group("Subtitle 1", array(
111  new I\Component\Item\Standard("title1"),
112  new I\Component\Item\Standard("title2")
113  )),
114  new I\Component\Item\Group("Subtitle 2", array(
115  new I\Component\Item\Standard("title3")
116  ))
117  );
118 
119  $c = $this->getUIFactory()->panelSecondary()->listing("title", $groups);
120 
121  $this->assertEquals($c->getItemGroups(), $groups);
122  }
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...
+ Here is the call graph for this function:

◆ testGetTitle()

PanelSecondaryListingTest::testGetTitle ( )

Definition at line 90 of file PanelSecondaryListingTest.php.

References Vendor\Package\$c, getUIFactory(), and ILIAS\UI\Implementation\Component\Input\Group.

90  : void
91  {
92  $groups = array(
93  new I\Component\Item\Group("Subtitle 1", array(
94  new I\Component\Item\Standard("title1"),
95  new I\Component\Item\Standard("title2")
96  )),
97  new I\Component\Item\Group("Subtitle 2", array(
98  new I\Component\Item\Standard("title3")
99  ))
100  );
101 
102  $c = $this->getUIFactory()->panelSecondary()->listing("title", $groups);
103 
104  $this->assertEquals("title", $c->getTitle());
105  }
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...
+ Here is the call graph for this function:

◆ testImplementsFactoryInterface()

PanelSecondaryListingTest::testImplementsFactoryInterface ( )

Definition at line 74 of file PanelSecondaryListingTest.php.

References getUIFactory(), and ILIAS\UI\Implementation\Component\Input\Group.

74  : void
75  {
76  $secondary_panel = $this->getUIFactory()->panelSecondary()->listing("List Title", array(
77 
78  new I\Component\Item\Group("Subtitle 1", array(
79  new I\Component\Item\Standard("title1"),
80  new I\Component\Item\Standard("title2")
81  )),
82  new I\Component\Item\Group("Subtitle 2", array(
83  new I\Component\Item\Standard("title3")
84  ))
85  ));
86 
87  $this->assertInstanceOf("ILIAS\\UI\\Component\\Panel\\Secondary\\Listing", $secondary_panel);
88  }
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...
+ Here is the call graph for this function:

◆ testRenderWithActions()

PanelSecondaryListingTest::testRenderWithActions ( )

Definition at line 141 of file PanelSecondaryListingTest.php.

References ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS\Repository\button(), ILIAS_UI_TestBase\getDefaultRenderer(), and getUIFactory().

141  : void
142  {
143  $actions = $this->getUIFactory()->dropdown()->standard(array(
144  $this->getUIFactory()->button()->shy("ILIAS", "https://www.ilias.de"),
145  $this->getUIFactory()->button()->shy("Github", "https://www.github.com")
146  ));
147 
148  $sec = $this->getUIFactory()->panelSecondary()->listing("Title", array())->withActions($actions);
149 
150  $html = $this->getDefaultRenderer()->render($sec);
151 
152  $expected_html = <<<EOT
153 <div class="panel panel-secondary panel-flex">
154  <div class="panel-heading ilHeader">
155  <div class="panel-title"><h2>Title</h2></div>
156  <div class="panel-controls">
157  <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>
158  <ul id="id_3_menu" class="dropdown-menu">
159  <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
160  <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">Github</button></li>
161  </ul>
162  </div>
163  </div>
164  </div>
165  <div class="panel-body">
166  </div>
167 </div>
168 EOT;
169  $this->assertEquals(
170  $this->brutallyTrimHTML($expected_html),
171  $this->brutallyTrimHTML($html)
172  );
173  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
button(string $caption, string $cmd)
Class ChatMainBarProvider .
Title class.
Definition: Title.php:26
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
+ Here is the call graph for this function:

◆ testRenderWithFooter()

PanelSecondaryListingTest::testRenderWithFooter ( )

Definition at line 302 of file PanelSecondaryListingTest.php.

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

302  : void
303  {
304  $footer_shy_button = $this->getUIFactory()->button()->shy("Action", "");
305  $secondary_panel = $this->getUIFactory()->panelSecondary()->listing("", array())->withFooter($footer_shy_button);
306 
307  $html = $this->getDefaultRenderer()->render($secondary_panel);
308 
309  $expected_html = <<<EOT
310 <div class="panel panel-secondary panel-flex">\n
311 <div class="panel-body"></div>\n
312 <div class="panel-footer ilBlockInfo"><button class="btn btn-link" data-action="">Action</button></div>\n
313 </div>\n
314 
315 EOT;
316  $this->assertHTMLEquals(
317  $this->cleanHTML($expected_html),
318  $this->cleanHTML($html)
319  );
320  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
button(string $caption, string $cmd)
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:458
+ Here is the call graph for this function:

◆ testRenderWithNoHeaderButContent()

PanelSecondaryListingTest::testRenderWithNoHeaderButContent ( )

Definition at line 322 of file PanelSecondaryListingTest.php.

References ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), getUIFactory(), and ILIAS\UI\Implementation\Component\Input\Group.

322  : void
323  {
324  $group = new I\Component\Item\Group(
325  "Subtitle 1",
326  array(
327  new I\Component\Item\Standard("title1"),
328  new I\Component\Item\Standard("title2"))
329  );
330 
331  $secondary_panel = $this->getUIFactory()->panelSecondary()->listing("", array($group));
332 
333  $html = $this->getDefaultRenderer()->render($secondary_panel);
334 
335  $expected_html = <<<EOT
336 <div class="panel panel-secondary panel-flex">
337  <div class="panel-body">
338  <div class="il-item-group">
339  <h3>Subtitle 1</h3>
340  <div class="il-item-group-items">
341  <ul>
342  <li class="il-std-item-container">
343  <div class="il-item il-std-item ">
344  <h4 class="il-item-title">title1</h4>
345  </div>
346  </li>
347  <li class="il-std-item-container">
348  <div class="il-item il-std-item ">
349  <h4 class="il-item-title">title2</h4>
350  </div>
351  </li>
352  </ul>
353  </div>
354  </div>
355  </div>
356 </div>
357 EOT;
358  $this->assertHTMLEquals(
359  $this->brutallyTrimHTML($expected_html),
360  $this->brutallyTrimHTML($html)
361  );
362  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
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...
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
+ Here is the call graph for this function:

◆ testRenderWithNoHeaderNoContentNoFooter()

PanelSecondaryListingTest::testRenderWithNoHeaderNoContentNoFooter ( )

Definition at line 364 of file PanelSecondaryListingTest.php.

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

364  : void
365  {
366  $secondary_panel = $this->getUIFactory()->panelSecondary()->listing("", array());
367 
368  $html = $this->getDefaultRenderer()->render($secondary_panel);
369 
370  $this->assertEquals("", $html);
371  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
+ Here is the call graph for this function:

◆ testRenderWithPagination()

PanelSecondaryListingTest::testRenderWithPagination ( )

Definition at line 216 of file PanelSecondaryListingTest.php.

References ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS\Repository\button(), ILIAS_UI_TestBase\getDefaultRenderer(), and getUIFactory().

216  : void
217  {
218  $pagination = $this->getUIFactory()->viewControl()->pagination()
219  ->withTargetURL('http://ilias.de', 'page')
220  ->withTotalEntries(10)
221  ->withPageSize(2)
222  ->withCurrentPage(1);
223 
224  $sec = $this->getUIFactory()->panelSecondary()->listing("Title", array())
225  ->withViewControls([$pagination]);
226 
227  $html = $this->getDefaultRenderer()->render($sec);
228 
229  $expected_html = <<<EOT
230 <div class="panel panel-secondary panel-flex">
231  <div class="panel-heading ilHeader">
232  <div class="panel-title"><h2>Title</h2></div>
233  <div class="panel-viewcontrols l-bar__space-keeper">
234  <div class="il-viewcontrol-pagination l-bar__element">
235  <span class="btn btn-ctrl browse previous">
236  <a tabindex="0" class="glyph" href="http://ilias.de?page=0" aria-label="back">
237  <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
238  </a>
239  </span>
240  <button class="btn btn-link" data-action="http://ilias.de?page=0" id="id_1">1</button>
241  <button class="btn btn-link engaged" aria-pressed="true" data-action="http://ilias.de?page=1" id="id_2">2</button>
242  <button class="btn btn-link" data-action="http://ilias.de?page=2" id="id_3">3</button>
243  <button class="btn btn-link" data-action="http://ilias.de?page=3" id="id_4">4</button>
244  <button class="btn btn-link" data-action="http://ilias.de?page=4" id="id_5">5</button>
245  <span class="btn btn-ctrl browse next">
246  <a tabindex="0" class="glyph" href="http://ilias.de?page=2" aria-label="next">
247  <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
248  </a>
249  </span>
250  </div>
251  </div>
252  <div class="panel-controls"></div>
253  </div>
254  <div class="panel-body">
255  </div>
256 </div>
257 EOT;
258  $this->assertEquals(
259  $this->brutallyTrimHTML($expected_html),
260  $this->brutallyTrimHTML($html)
261  );
262  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
button(string $caption, string $cmd)
Title class.
Definition: Title.php:26
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
+ Here is the call graph for this function:

◆ testRenderWithSection()

PanelSecondaryListingTest::testRenderWithSection ( )

Definition at line 264 of file PanelSecondaryListingTest.php.

References ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS\Repository\button(), ILIAS_UI_TestBase\getDefaultRenderer(), and getUIFactory().

264  : void
265  {
266  $back = $this->getUIFactory()->button()->standard("previous", "http://www.ilias.de");
267  $next = $this->getUIFactory()->button()->standard("next", "http://www.github.com");
268  $current = $this->getUIFactory()->button()->standard("current", "");
269  $section = $this->getUIFactory()->viewControl()->section($back, $current, $next);
270 
271  $secondary_panel = $this->getUIFactory()->panelSecondary()->listing("Title", array())
272  ->withViewControls([$section]);
273 
274  $html = $this->getDefaultRenderer()->render($secondary_panel);
275 
276  $expected_html = <<<EOT
277 <div class="panel panel-secondary panel-flex">
278  <div class="panel-heading ilHeader">
279  <div class="panel-title"><h2>Title</h2></div>
280  <div class="panel-viewcontrols l-bar__space-keeper">
281  <div class="il-viewcontrol-section l-bar__element">
282  <a class="btn btn-ctrl browse previous" href="http://www.ilias.de" aria-label="previous" data-action="http://www.ilias.de" id="id_1">
283  <span class="glyphicon glyphicon-chevron-left"></span>
284  </a>
285  <button class="btn btn-default" data-action="">current</button>
286  <a class="btn btn-ctrl browse next" href="http://www.github.com" aria-label="next" data-action="http://www.github.com" id="id_2">
287  <span class="glyphicon glyphicon-chevron-right"></span>
288  </a>
289  </div>
290  </div>
291  <div class="panel-controls"></div>
292  </div>
293  <div class="panel-body">
294  </div>
295 </div>
296 EOT;
297  $this->assertEquals(
298  $this->brutallyTrimHTML($expected_html),
299  $this->brutallyTrimHTML($html)
300  );
301  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
button(string $caption, string $cmd)
Title class.
Definition: Title.php:26
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
+ Here is the call graph for this function:

◆ testRenderWithSortation()

PanelSecondaryListingTest::testRenderWithSortation ( )

Definition at line 175 of file PanelSecondaryListingTest.php.

References ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS\Repository\button(), ILIAS_UI_TestBase\getDefaultRenderer(), and getUIFactory().

175  : void
176  {
177  $sort_options = array(
178  'a' => 'A',
179  'b' => 'B'
180  );
181  $sortation = $this->getUIFactory()->viewControl()->sortation($sort_options);
182  $sec = $this->getUIFactory()->panelSecondary()->listing("Title", array())
183  ->withViewControls([$sortation]);
184 
185  $html = $this->getDefaultRenderer()->render($sec);
186 
187  $expected_html = <<<EOT
188 <div class="panel panel-secondary panel-flex">
189  <div class="panel-heading ilHeader">
190  <div class="panel-title"><h2>Title</h2></div>
191  <div class="panel-viewcontrols l-bar__space-keeper">
192  <div class="il-viewcontrol-sortation l-bar__element" id="id_1">
193  <div class="dropdown">
194  <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">
195  <span class="caret"></span>
196  </button>
197  <ul id="id_4_menu" class="dropdown-menu">
198  <li><button class="btn btn-link" data-action="?sortation=a" id="id_2">A</button></li>
199  <li><button class="btn btn-link" data-action="?sortation=b" id="id_3">B</button></li>
200  </ul>
201  </div>
202  </div>
203  </div>
204  <div class="panel-controls"></div>
205  </div>
206  <div class="panel-body">
207  </div>
208 </div>
209 EOT;
210  $this->assertEquals(
211  $this->brutallyTrimHTML($expected_html),
212  $this->brutallyTrimHTML($html)
213  );
214  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Avatar.php:21
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
button(string $caption, string $cmd)
Title class.
Definition: Title.php:26
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
+ Here is the call graph for this function:

◆ testWithActions()

PanelSecondaryListingTest::testWithActions ( )

Definition at line 124 of file PanelSecondaryListingTest.php.

References Vendor\Package\$c, and getUIFactory().

124  : void
125  {
126  $actions = new I\Component\Dropdown\Standard(array(
127  new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
128  new I\Component\Button\Shy("GitHub", "https://www.github.com")
129  ));
130 
131  $groups = array();
132 
133  $c = $this->getUIFactory()->panelSecondary()->listing("title", $groups)
134  ->withActions($actions);
135 
136  $this->assertEquals($c->getActions(), $actions);
137  }
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...
+ Here is the call graph for this function:

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