ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
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 ()
 

Protected Member Functions

 cleanHTML (string $html)
 

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.

67  : string
68  {
69  $html = str_replace(["\n", "\t"], "", $html);
70 
71  return trim($html);
72  }

◆ 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(): I\Component\Dropdown\Factory
42  {
43  return new I\Component\Dropdown\Factory();
44  }
45 
46  public function viewControl(): I\Component\ViewControl\Factory
47  {
48  return new I\Component\ViewControl\Factory(new SignalGenerator());
49  }
50 
51  public function button(): I\Component\Button\Factory
52  {
53  return new I\Component\Button\Factory();
54  }
55 
56  public function symbol(): I\Component\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)
+ 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 $c, getUIFactory(), and ILIAS\ILIASObject\Creation\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  }
$c
Definition: deliver.php:25
+ Here is the call graph for this function:

◆ testGetTitle()

PanelSecondaryListingTest::testGetTitle ( )

Definition at line 90 of file PanelSecondaryListingTest.php.

References $c, getUIFactory(), and ILIAS\ILIASObject\Creation\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  }
$c
Definition: deliver.php:25
+ Here is the call graph for this function:

◆ testImplementsFactoryInterface()

PanelSecondaryListingTest::testImplementsFactoryInterface ( )

Definition at line 74 of file PanelSecondaryListingTest.php.

References getUIFactory(), and ILIAS\ILIASObject\Creation\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  }
+ Here is the call graph for this function:

◆ testRenderWithActions()

PanelSecondaryListingTest::testRenderWithActions ( )

Definition at line 141 of file PanelSecondaryListingTest.php.

References ILIAS\Repository\button(), 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" id="id_3"><button class="btn btn-default dropdown-toggle" type="button" 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  }
button(string $caption, string $cmd)
Interface Observer Contains several chained tasks and infos about them.
Title class.
Definition: Title.php:41
+ Here is the call graph for this function:

◆ testRenderWithFooter()

PanelSecondaryListingTest::testRenderWithFooter ( )

Definition at line 296 of file PanelSecondaryListingTest.php.

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

296  : void
297  {
298  $footer_shy_button = $this->getUIFactory()->button()->shy("Action", "");
299  $secondary_panel = $this->getUIFactory()->panelSecondary()->listing("", array())->withFooter($footer_shy_button);
300 
301  $html = $this->getDefaultRenderer()->render($secondary_panel);
302 
303  $expected_html = <<<EOT
304 <div class="panel panel-secondary panel-flex">\n
305 <div class="panel-body"></div>\n
306 <div class="panel-footer ilBlockInfo"><button class="btn btn-link" data-action="">Action</button></div>\n
307 </div>\n
308 
309 EOT;
310  $this->assertHTMLEquals(
311  $this->brutallyTrimHTML($expected_html),
312  $this->brutallyTrimHTML($html)
313  );
314  }
button(string $caption, string $cmd)
+ Here is the call graph for this function:

◆ testRenderWithNoHeaderButContent()

PanelSecondaryListingTest::testRenderWithNoHeaderButContent ( )

Definition at line 316 of file PanelSecondaryListingTest.php.

References getUIFactory(), and ILIAS\ILIASObject\Creation\Group.

316  : void
317  {
318  $group = new I\Component\Item\Group(
319  "Subtitle 1",
320  array(
321  new I\Component\Item\Standard("title1"),
322  new I\Component\Item\Standard("title2"))
323  );
324 
325  $secondary_panel = $this->getUIFactory()->panelSecondary()->listing("", array($group));
326 
327  $html = $this->getDefaultRenderer()->render($secondary_panel);
328 
329  $expected_html = <<<EOT
330 <div class="panel panel-secondary panel-flex">
331  <div class="panel-body">
332  <div class="il-item-group">
333  <h3>Subtitle 1</h3>
334  <div class="il-item-group-items">
335  <ul>
336  <li class="il-std-item-container">
337  <div class="il-item il-std-item ">
338  <h4 class="il-item-title">title1</h4>
339  </div>
340  </li>
341  <li class="il-std-item-container">
342  <div class="il-item il-std-item ">
343  <h4 class="il-item-title">title2</h4>
344  </div>
345  </li>
346  </ul>
347  </div>
348  </div>
349  </div>
350 </div>
351 EOT;
352  $this->assertHTMLEquals(
353  $this->brutallyTrimHTML($expected_html),
354  $this->brutallyTrimHTML($html)
355  );
356  }
+ Here is the call graph for this function:

◆ testRenderWithNoHeaderNoContentNoFooter()

PanelSecondaryListingTest::testRenderWithNoHeaderNoContentNoFooter ( )

Definition at line 358 of file PanelSecondaryListingTest.php.

References getUIFactory().

358  : void
359  {
360  $secondary_panel = $this->getUIFactory()->panelSecondary()->listing("", array());
361 
362  $html = $this->getDefaultRenderer()->render($secondary_panel);
363 
364  $this->assertEquals("", $html);
365  }
+ Here is the call graph for this function:

◆ testRenderWithPagination()

PanelSecondaryListingTest::testRenderWithPagination ( )

Definition at line 215 of file PanelSecondaryListingTest.php.

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

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

◆ testRenderWithSection()

PanelSecondaryListingTest::testRenderWithSection ( )

Definition at line 258 of file PanelSecondaryListingTest.php.

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

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

◆ testRenderWithSortation()

PanelSecondaryListingTest::testRenderWithSortation ( )

Definition at line 175 of file PanelSecondaryListingTest.php.

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

175  : void
176  {
177  $sort_options = array(
178  'a' => 'A',
179  'b' => 'B'
180  );
181  $sortation = $this->getUIFactory()->viewControl()->sortation($sort_options, 'a');
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="dropdown il-viewcontrol il-viewcontrol-sortation l-bar__element" id="id_1">
193  <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-label="sortation" aria-haspopup="true" aria-expanded="false" aria-controls="id_1_ctrl">
194  <span class="label">vc_sort A</span>
195  <span class="glyphicon-sort"></span>
196  </button>
197  <ul id="id_1_ctrl" class="dropdown-menu">
198  <li class="selected"><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 class="panel-controls"></div>
204  </div>
205  <div class="panel-body">
206  </div>
207 </div>
208 EOT;
209  $this->assertEquals(
210  $this->brutallyTrimHTML($expected_html),
211  $this->brutallyTrimHTML($html)
212  );
213  }
button(string $caption, string $cmd)
Title class.
Definition: Title.php:41
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21
+ Here is the call graph for this function:

◆ testWithActions()

PanelSecondaryListingTest::testWithActions ( )

Definition at line 124 of file PanelSecondaryListingTest.php.

References $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  }
$c
Definition: deliver.php:25
+ Here is the call graph for this function:

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