ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
PanelSecondaryLegacyTest Class Reference

Test secondary legacy panels. More...

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

Public Member Functions

 getUIFactory ()
 
 testImplementsFactoryInterface ()
 
 testGetTitle ()
 
 testGetLegacyComponent ()
 
 testWithActions ()
 
 testWithoutViewControls ()
 
 testWithSortationViewControl ()
 
 testWithPaginationViewControl ()
 
 testWithSectionViewControl ()
 
 testRenderPanelSecondaryWithActions ()
 
 testRenderPanelSecondaryWithSortation ()
 
 testRenderPanelSecondaryWithPagination ()
 
 testRenderPanelSecondaryWithSection ()
 
 testRenderPanelSecondaryWithFooter ()
 
 testRenderPanelSecondaryWithNoHeader ()
 

Protected Member Functions

 cleanHTML (string $html)
 

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 72 of file PanelSecondaryLegacyTest.php.

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

◆ getUIFactory()

PanelSecondaryLegacyTest::getUIFactory ( )

Definition at line 33 of file PanelSecondaryLegacyTest.php.

References ILIAS\Repository\button(), ILIAS\UI\examples\MainControls\Slate\Legacy\legacy(), and ILIAS\Repository\symbol().

Referenced by testGetLegacyComponent(), testGetTitle(), testImplementsFactoryInterface(), testRenderPanelSecondaryWithActions(), testRenderPanelSecondaryWithFooter(), testRenderPanelSecondaryWithNoHeader(), testRenderPanelSecondaryWithPagination(), testRenderPanelSecondaryWithSection(), testRenderPanelSecondaryWithSortation(), testWithActions(), testWithoutViewControls(), testWithPaginationViewControl(), testWithSectionViewControl(), and testWithSortationViewControl().

33  : NoUIFactory
34  {
35  return new class () extends NoUIFactory {
36  public function legacyPanel(string $title, C\Legacy\Content $content): I\Component\Panel\Secondary\Legacy
37  {
38  return new I\Component\Panel\Secondary\Legacy($title, $content);
39  }
40 
41  public function legacy(): I\Component\Legacy\Factory
42  {
43  return new I\Component\Legacy\Factory(new I\Component\SignalGenerator());
44  }
45 
46  public function dropdown(): I\Component\Dropdown\Factory
47  {
48  return new I\Component\Dropdown\Factory();
49  }
50 
51  public function viewControl(): I\Component\ViewControl\Factory
52  {
53  return new I\Component\ViewControl\Factory(new SignalGenerator());
54  }
55 
56  public function button(): I\Component\Button\Factory
57  {
58  return new I\Component\Button\Factory();
59  }
60 
61  public function symbol(): I\Component\Symbol\Factory
62  {
63  return new I\Component\Symbol\Factory(
64  new I\Component\Symbol\Icon\Factory(),
65  new I\Component\Symbol\Glyph\Factory(),
66  new I\Component\Symbol\Avatar\Factory()
67  );
68  }
69  };
70  }
button(string $caption, string $cmd)
legacy()
expected output: > ILIAS shows the rendered Component.
Definition: legacy.php:29
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ testGetLegacyComponent()

PanelSecondaryLegacyTest::testGetLegacyComponent ( )

Definition at line 95 of file PanelSecondaryLegacyTest.php.

References getUIFactory().

95  : void
96  {
97  $legacy = $this->getUIfactory()->legacy()->content("Legacy content");
98  $secondary_panel = $this->getUIFactory()->legacyPanel("title", $legacy);
99 
100  $this->assertEquals($secondary_panel->getLegacyComponent(), $legacy);
101  }
+ Here is the call graph for this function:

◆ testGetTitle()

PanelSecondaryLegacyTest::testGetTitle ( )

Definition at line 87 of file PanelSecondaryLegacyTest.php.

References getUIFactory().

87  : void
88  {
89  $legacy = $this->getUIfactory()->legacy()->content("Legacy content");
90  $secondary_panel = $this->getUIFactory()->legacyPanel("Title", $legacy);
91 
92  $this->assertEquals("Title", $secondary_panel->getTitle());
93  }
+ Here is the call graph for this function:

◆ testImplementsFactoryInterface()

PanelSecondaryLegacyTest::testImplementsFactoryInterface ( )

Definition at line 79 of file PanelSecondaryLegacyTest.php.

References getUIFactory().

79  : void
80  {
81  $legacy = $this->getUIfactory()->legacy()->content("Legacy content");
82  $secondary_panel = $this->getUIFactory()->legacyPanel("List Title", $legacy);
83 
84  $this->assertInstanceOf("ILIAS\\UI\\Component\\Panel\\Secondary\\Legacy", $secondary_panel);
85  }
+ Here is the call graph for this function:

◆ testRenderPanelSecondaryWithActions()

PanelSecondaryLegacyTest::testRenderPanelSecondaryWithActions ( )

Definition at line 179 of file PanelSecondaryLegacyTest.php.

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

179  : void
180  {
181  $legacy = $this->getUIfactory()->legacy()->content("Legacy content");
182  $actions = $this->getUIFactory()->dropdown()->standard(array(
183  $this->getUIFactory()->button()->shy("ILIAS", "https://www.ilias.de"),
184  $this->getUIFactory()->button()->shy("Github", "https://www.github.com")
185  ));
186 
187  $sec = $this->getUIFactory()->legacyPanel("Title", $legacy)->withActions($actions);
188 
189  $html = $this->getDefaultRenderer()->render($sec);
190 
191  $expected_html = <<<EOT
192 <div class="panel panel-secondary panel-flex">
193  <div class="panel-heading ilHeader">
194  <div class="panel-title"><h2>Title</h2></div>
195  <div class="panel-controls">
196  <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>
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>
204 
205  <div class="panel-body">
206  Legacy content
207  </div>
208 </div>
209 EOT;
210  $this->assertHTMLEquals(
211  $this->brutallyTrimHTML($expected_html),
212  $this->brutallyTrimHTML($html)
213  );
214  }
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:

◆ testRenderPanelSecondaryWithFooter()

PanelSecondaryLegacyTest::testRenderPanelSecondaryWithFooter ( )

Definition at line 323 of file PanelSecondaryLegacyTest.php.

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

323  : void
324  {
325  $legacy = $this->getUIfactory()->legacy()->content("Legacy content");
326  $footer_shy_button = $this->getUIFactory()->button()->shy("Action", "");
327 
328  $secondary_panel = $this->getUIFactory()->legacyPanel("Title", $legacy)
329  ->withFooter($footer_shy_button);
330 
331  $html = $this->getDefaultRenderer()->render($secondary_panel);
332 
333  $expected_html = <<<EOT
334 <div class="panel panel-secondary panel-flex">
335  <div class="panel-heading ilHeader">
336  <div class="panel-title"><h2>Title</h2></div>
337  <div class="panel-controls"></div>
338  </div>
339  <div class="panel-body">
340  Legacy content
341  </div>
342  <div class="panel-footer ilBlockInfo">
343  <button class="btn btn-link" data-action="">Action</button>
344  </div>
345 </div>
346 EOT;
347  $this->assertEquals($this->brutallyTrimHTML($expected_html), $this->brutallyTrimHTML($html));
348  }
button(string $caption, string $cmd)
Title class.
Definition: Title.php:41
+ Here is the call graph for this function:

◆ testRenderPanelSecondaryWithNoHeader()

PanelSecondaryLegacyTest::testRenderPanelSecondaryWithNoHeader ( )

Definition at line 350 of file PanelSecondaryLegacyTest.php.

References getUIFactory().

350  : void
351  {
352  $legacy = $this->getUIfactory()->legacy()->content("Legacy content");
353 
354  $secondary_panel = $this->getUIFactory()->legacyPanel("", $legacy);
355 
356  $html = $this->getDefaultRenderer()->render($secondary_panel);
357 
358  $expected_html = <<<EOT
359 <div class="panel panel-secondary panel-flex">
360  <div class="panel-body">Legacy content</div>
361 </div>
362 EOT;
363  $this->assertEquals($this->brutallyTrimHTML($expected_html), $this->brutallyTrimHTML($html));
364  }
+ Here is the call graph for this function:

◆ testRenderPanelSecondaryWithPagination()

PanelSecondaryLegacyTest::testRenderPanelSecondaryWithPagination ( )

Definition at line 253 of file PanelSecondaryLegacyTest.php.

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

253  : void
254  {
255  $legacy = $this->getUIfactory()->legacy()->content("Legacy content");
256 
257  $pagination = $this->getUIFactory()->viewControl()->pagination()
258  ->withTargetURL('http://ilias.de', 'page')
259  ->withTotalEntries(10)
260  ->withPageSize(2)
261  ->withCurrentPage(1);
262 
263  $sec = $this->getUIFactory()->legacyPanel("Title", $legacy)
264  ->withViewControls([$pagination]);
265 
266  $html = $this->getDefaultRenderer()->render($sec);
267 
268  $expected_html = <<<EOT
269 <div class="panel panel-secondary panel-flex">
270  <div class="panel-heading ilHeader">
271  <div class="panel-title"><h2>Title</h2></div>
272  <div class="panel-viewcontrols l-bar__space-keeper">
273  <div class="il-viewcontrol-pagination l-bar__element">
274  <span class="btn btn-ctrl browse previous"><a tabindex="0" class="glyph" href="http://ilias.de?page=0" aria-label="back"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span></a></span>
275  <button class="btn btn-link" data-action="http://ilias.de?page=0" id="id_1">1</button>
276  <button class="btn btn-link engaged" aria-pressed="true" data-action="http://ilias.de?page=1" id="id_2">2</button>
277  <button class="btn btn-link" data-action="http://ilias.de?page=2" id="id_3">3</button>
278  <button class="btn btn-link" data-action="http://ilias.de?page=3" id="id_4">4</button>
279  <button class="btn btn-link" data-action="http://ilias.de?page=4" id="id_5">5</button>
280  <span class="btn btn-ctrl browse next"><a tabindex="0" class="glyph" href="http://ilias.de?page=2" aria-label="next"><span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></a></span>
281  </div>
282  </div>
283  <div class="panel-controls"></div>
284  </div>
285  <div class="panel-body">Legacy content</div>
286 </div>
287 EOT;
288  $this->assertEquals($this->brutallyTrimHTML($expected_html), $this->brutallyTrimHTML($html));
289  }
button(string $caption, string $cmd)
Title class.
Definition: Title.php:41
+ Here is the call graph for this function:

◆ testRenderPanelSecondaryWithSection()

PanelSecondaryLegacyTest::testRenderPanelSecondaryWithSection ( )

Definition at line 291 of file PanelSecondaryLegacyTest.php.

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

291  : void
292  {
293  $legacy = $this->getUIfactory()->legacy()->content("Legacy content");
294  $back = $this->getUIFactory()->button()->standard("previous", "http://www.ilias.de");
295  $next = $this->getUIFactory()->button()->standard("next", "http://www.github.com");
296  $current = $this->getUIFactory()->button()->standard("current", "");
297  $section = $this->getUIFactory()->viewControl()->section($back, $current, $next);
298 
299  $secondary_panel = $this->getUIFactory()->legacyPanel("Title", $legacy)
300  ->withViewControls([$section]);
301 
302  $html = $this->getDefaultRenderer()->render($secondary_panel);
303 
304  $expected_html = <<<EOT
305 <div class="panel panel-secondary panel-flex">
306  <div class="panel-heading ilHeader">
307  <div class="panel-title"><h2>Title</h2></div>
308  <div class="panel-viewcontrols l-bar__space-keeper">
309  <div class="il-viewcontrol-section l-bar__element">
310  <a class="btn btn-ctrl browse previous" href="http://www.ilias.de" aria-label="previous" data-action="http://www.ilias.de" id="id_1"><span class="glyphicon glyphicon-chevron-left"></span></a>
311  <button class="btn btn-default" data-action="">current</button>
312  <a class="btn btn-ctrl browse next" href="http://www.github.com" aria-label="next" data-action="http://www.github.com" id="id_2"><span class="glyphicon glyphicon-chevron-right"></span></a>
313  </div>
314  </div>
315  <div class="panel-controls"></div>
316  </div>
317  <div class="panel-body">Legacy content</div>
318 </div>
319 EOT;
320  $this->assertEquals($this->brutallyTrimHTML($expected_html), $this->brutallyTrimHTML($html));
321  }
button(string $caption, string $cmd)
Title class.
Definition: Title.php:41
+ Here is the call graph for this function:

◆ testRenderPanelSecondaryWithSortation()

PanelSecondaryLegacyTest::testRenderPanelSecondaryWithSortation ( )

Definition at line 216 of file PanelSecondaryLegacyTest.php.

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

216  : void
217  {
218  $legacy = $this->getUIfactory()->legacy()->content("Legacy content");
219  $sort_options = array(
220  'a' => 'A',
221  'b' => 'B'
222  );
223  $sortation = $this->getUIFactory()->viewControl()->sortation($sort_options, 'b');
224  $sec = $this->getUIFactory()->legacyPanel("Title", $legacy)
225  ->withViewControls([$sortation]);
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="dropdown il-viewcontrol il-viewcontrol-sortation l-bar__element" id="id_1">
235  <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">
236  <span class="label">vc_sort B</span>
237  <span class="glyphicon-sort"></span>
238  </button>
239  <ul id="id_1_ctrl" class="dropdown-menu">
240  <li><button class="btn btn-link" data-action="?sortation=a" id="id_2">A</button></li>
241  <li class="selected"><button class="btn btn-link" data-action="?sortation=b" id="id_3">B</button></li>
242  </ul>
243  </div>
244  </div>
245  <div class="panel-controls"></div>
246  </div>
247  <div class="panel-body">Legacy content</div>
248 </div>
249 EOT;
250  $this->assertEquals($this->brutallyTrimHTML($expected_html), $this->brutallyTrimHTML($html));
251  }
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()

PanelSecondaryLegacyTest::testWithActions ( )

Definition at line 103 of file PanelSecondaryLegacyTest.php.

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

103  : void
104  {
105  $legacy = $this->getUIfactory()->legacy()->content("Legacy content");
106  $actions = $this->getUIFactory()->dropdown()->standard(array(
107  $this->getUIFactory()->button()->shy("ILIAS", "https://www.ilias.de"),
108  $this->getUIFactory()->button()->shy("Github", "https://www.github.com")
109  ));
110 
111  $secondary_panel = $this->getUIFactory()->legacyPanel("title", $legacy)
112  ->withActions($actions);
113 
114  $this->assertEquals($secondary_panel->getActions(), $actions);
115  }
button(string $caption, string $cmd)
+ Here is the call graph for this function:

◆ testWithoutViewControls()

PanelSecondaryLegacyTest::testWithoutViewControls ( )

Definition at line 117 of file PanelSecondaryLegacyTest.php.

References getUIFactory(), and null.

117  : void
118  {
119  $legacy = $this->getUIfactory()->legacy()->content("Legacy content");
120  $secondary_panel = $this->getUIFactory()->legacyPanel("title", $legacy);
121  $array_vc = $secondary_panel->getViewControls();
122 
123  $this->assertEquals(null, $array_vc);
124  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ testWithPaginationViewControl()

PanelSecondaryLegacyTest::testWithPaginationViewControl ( )

Definition at line 144 of file PanelSecondaryLegacyTest.php.

References getUIFactory().

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

◆ testWithSectionViewControl()

PanelSecondaryLegacyTest::testWithSectionViewControl ( )

Definition at line 161 of file PanelSecondaryLegacyTest.php.

References getUIFactory().

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

◆ testWithSortationViewControl()

PanelSecondaryLegacyTest::testWithSortationViewControl ( )

Definition at line 126 of file PanelSecondaryLegacyTest.php.

References getUIFactory().

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

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