ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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 ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null)
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Protected Member Functions

 cleanHTML ($html)
 
- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML ($html)
 A more radical version of normalizeHTML. More...
 

Detailed Description

Test secondary legacy panels.

Definition at line 15 of file PanelSecondaryLegacyTest.php.

Member Function Documentation

◆ cleanHTML()

PanelSecondaryLegacyTest::cleanHTML (   $html)
protected

Definition at line 53 of file PanelSecondaryLegacyTest.php.

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().

54  {
55  $html = str_replace(["\n", "\t"], "", $html);
56 
57  return trim($html);
58  }
+ Here is the caller graph for this function:

◆ getUIFactory()

PanelSecondaryLegacyTest::getUIFactory ( )

Definition at line 17 of file PanelSecondaryLegacyTest.php.

References Vendor\Package\$f, $factory, and 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().

18  {
19  $factory = new class extends NoUIFactory {
20  public function legacyPanel($title, $content)
21  {
22  return new I\Component\Panel\Secondary\Legacy($title, $content);
23  }
24  public function legacy($content)
25  {
26  $f = new I\Component\Legacy\Factory(new I\Component\SignalGenerator());
27  return $f->legacy($content);
28  }
29  public function dropdown()
30  {
31  return new I\Component\Dropdown\Factory();
32  }
33  public function viewControl()
34  {
35  return new I\Component\ViewControl\Factory(new SignalGenerator());
36  }
37  public function button()
38  {
39  return new I\Component\Button\Factory();
40  }
41  public function symbol() : C\Symbol\Factory
42  {
43  return new I\Component\Symbol\Factory(
44  new I\Component\Symbol\Icon\Factory(),
45  new I\Component\Symbol\Glyph\Factory(),
46  new I\Component\Symbol\Avatar\Factory()
47  );
48  }
49  };
50  return $factory;
51  }
legacy()
Definition: legacy.php:3
$factory
Definition: metadata.php:58
+ 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 76 of file PanelSecondaryLegacyTest.php.

References getUIFactory().

77  {
78  $legacy = $this->getUIFactory()->legacy("Legacy content");
79  $secondary_panel = $this->getUIFactory()->legacyPanel("title", $legacy);
80 
81  $this->assertEquals($secondary_panel->getLegacyComponent(), $legacy);
82  }
+ Here is the call graph for this function:

◆ test_get_title()

PanelSecondaryLegacyTest::test_get_title ( )

Definition at line 68 of file PanelSecondaryLegacyTest.php.

References getUIFactory().

69  {
70  $legacy = $this->getUIFactory()->legacy("Legacy content");
71  $secondary_panel = $this->getUIFactory()->legacyPanel("Title", $legacy);
72 
73  $this->assertEquals($secondary_panel->getTitle(), "Title");
74  }
+ Here is the call graph for this function:

◆ test_implements_factory_interface()

PanelSecondaryLegacyTest::test_implements_factory_interface ( )

Definition at line 60 of file PanelSecondaryLegacyTest.php.

References getUIFactory().

61  {
62  $legacy = $this->getUIFactory()->legacy("Legacy content");
63  $secondary_panel = $this->getUIFactory()->legacyPanel("List Title", $legacy);
64 
65  $this->assertInstanceOf("ILIAS\\UI\\Component\\Panel\\Secondary\\Legacy", $secondary_panel);
66  }
+ Here is the call graph for this function:

◆ test_render_with_actions()

PanelSecondaryLegacyTest::test_render_with_actions ( )

Definition at line 160 of file PanelSecondaryLegacyTest.php.

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

161  {
162  $legacy = $this->getUIFactory()->legacy("Legacy content");
163  $actions = $this->getUIFactory()->dropdown()->standard(array(
164  $this->getUIFactory()->button()->shy("ILIAS", "https://www.ilias.de"),
165  $this->getUIFactory()->button()->shy("Github", "https://www.github.com")
166  ));
167 
168  $sec = $this->getUIFactory()->legacyPanel("Title", $legacy)->withActions($actions);
169 
170  $html = $this->getDefaultRenderer()->render($sec);
171 
172  $expected_html = <<<EOT
173 <div class="panel panel-secondary panel-flex">
174  <div class="panel-heading ilHeader">
175  <h4>Title</h4>
176  <div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-label="actions" aria-haspopup="true" aria-expanded="false"> <span class="caret"></span></button>
177  <ul class="dropdown-menu">
178  <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
179  <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">Github</button></li>
180  </ul>
181  </div>
182  </div>
183  <div class="panel-body">
184  Legacy content
185  </div>
186 </div>
187 EOT;
188  $this->assertHTMLEquals(
189  $this->cleanHTML($expected_html),
190  $this->cleanHTML($html)
191  );
192  }
Class ChatMainBarProvider .
Title class.
Definition: Title.php:36
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:268
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:326
+ Here is the call graph for this function:

◆ test_render_with_footer()

PanelSecondaryLegacyTest::test_render_with_footer ( )

Definition at line 322 of file PanelSecondaryLegacyTest.php.

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

323  {
324  $legacy = $this->getUIFactory()->legacy("Legacy content");
325  $footer_shy_button = $this->getUIFactory()->button()->shy("Action", "");
326 
327  $secondary_panel = $this->getUIFactory()->legacyPanel("Title", $legacy)
328  ->withFooter($footer_shy_button);
329 
330  $html = $this->getDefaultRenderer()->render($secondary_panel);
331 
332  $expected_html = <<<EOT
333 <div class="panel panel-secondary panel-flex">
334  <div class="panel-heading ilHeader">
335  <h4>Title</h4>
336  </div>
337  <div class="panel-body">
338  Legacy content
339  </div>
340  <div class="panel-footer ilBlockInfo">
341  <button class="btn btn-link" data-action="">Action</button>
342  </div>
343 </div>
344 EOT;
345  $this->assertHTMLEquals(
346  $this->cleanHTML($expected_html),
347  $this->cleanHTML($html)
348  );
349  }
Title class.
Definition: Title.php:36
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:268
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:326
+ Here is the call graph for this function:

◆ test_render_with_no_header()

PanelSecondaryLegacyTest::test_render_with_no_header ( )

Definition at line 351 of file PanelSecondaryLegacyTest.php.

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

352  {
353  $legacy = $this->getUIFactory()->legacy("Legacy content");
354 
355  $secondary_panel = $this->getUIFactory()->legacyPanel("", $legacy);
356 
357  $html = $this->getDefaultRenderer()->render($secondary_panel);
358 
359  $expected_html = <<<EOT
360 <div class="panel panel-secondary panel-flex">
361  <div class="panel-body">
362  Legacy content
363  </div>
364 </div>
365 EOT;
366  $this->assertHTMLEquals(
367  $this->cleanHTML($expected_html),
368  $this->cleanHTML($html)
369  );
370  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:268
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:326
+ Here is the call graph for this function:

◆ test_render_with_pagination()

PanelSecondaryLegacyTest::test_render_with_pagination ( )

Definition at line 234 of file PanelSecondaryLegacyTest.php.

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

235  {
236  $legacy = $this->getUIFactory()->legacy("Legacy content");
237 
238  $pagination = $this->getUIFactory()->viewControl()->pagination()
239  ->withTargetURL('http://ilias.de', 'page')
240  ->withTotalEntries(10)
241  ->withPageSize(2)
242  ->withCurrentPage(1);
243 
244  $sec = $this->getUIFactory()->legacyPanel("Title", $legacy)
245  ->withViewControls([$pagination]);
246 
247  $html = $this->getDefaultRenderer()->render($sec);
248 
249  $expected_html = <<<EOT
250 <div class="panel panel-secondary panel-flex">
251  <div class="panel-heading ilHeader">
252  <h4>Title</h4>
253  <div class="il-viewcontrol-pagination">
254  <span class="browse previous">
255  <a class="glyph" href="http://ilias.de?page=0" aria-label="back">
256  <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
257  </a>
258  </span>
259  <button class="btn btn-link" data-action="http://ilias.de?page=0" id="id_1">1</button>
260  <button class="btn btn-link" data-action="http://ilias.de?page=1" disabled="true">2</button>
261  <button class="btn btn-link" data-action="http://ilias.de?page=2" id="id_2">3</button>
262  <button class="btn btn-link" data-action="http://ilias.de?page=3" id="id_3">4</button>
263  <button class="btn btn-link" data-action="http://ilias.de?page=4" id="id_4">5</button>
264  <span class="browse next">
265  <a class="glyph" href="http://ilias.de?page=2" aria-label="next">
266  <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
267  </a>
268  </span>
269  </div>
270  </div>
271  <div class="panel-body">
272  Legacy content
273  </div>
274 </div>
275 EOT;
276  $this->assertHTMLEquals(
277  $this->cleanHTML($expected_html),
278  $this->cleanHTML($html)
279  );
280  }
Title class.
Definition: Title.php:36
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:268
disabled()
Example showing how to plug a disabled checkbox into a form.
Definition: disabled.php:5
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:326
+ Here is the call graph for this function:

◆ test_render_with_section()

PanelSecondaryLegacyTest::test_render_with_section ( )

Definition at line 282 of file PanelSecondaryLegacyTest.php.

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

283  {
284  $legacy = $this->getUIFactory()->legacy("Legacy content");
285  $back = $this->getUIFactory()->button()->standard("previous", "http://www.ilias.de");
286  $next = $this->getUIFactory()->button()->standard("next", "http://www.github.com");
287  $current = $this->getUIFactory()->button()->standard("current", "");
288  $section = $this->getUIFactory()->viewControl()->section($back, $current, $next);
289 
290  $secondary_panel = $this->getUIFactory()->legacyPanel("Title", $legacy)
291  ->withViewControls([$section]);
292 
293  $html = $this->getDefaultRenderer()->render($secondary_panel);
294 
295  $expected_html = <<<EOT
296 <div class="panel panel-secondary panel-flex">
297  <div class="panel-heading ilHeader">
298  <h4>Title</h4>
299  <div class="il-viewcontrol-section">
300  <a class="btn btn-default " href="http://www.ilias.de" aria-label="previous" data-action="http://www.ilias.de">
301  <span class="glyphicon glyphicon-chevron-left"></span>
302  </a>
303  <button class="btn btn-default" data-action="">
304  current
305  </button>
306  <a class="btn btn-default " href="http://www.github.com" aria-label="next" data-action="http://www.github.com">
307  <span class="glyphicon glyphicon-chevron-right"></span>
308  </a>
309  </div>
310  </div>
311  <div class="panel-body">
312  Legacy content
313  </div>
314 </div>
315 EOT;
316  $this->assertHTMLEquals(
317  $this->cleanHTML($expected_html),
318  $this->cleanHTML($html)
319  );
320  }
Title class.
Definition: Title.php:36
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:268
$section
Definition: Utf8Test.php:83
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:326
+ Here is the call graph for this function:

◆ test_render_with_sortation()

PanelSecondaryLegacyTest::test_render_with_sortation ( )

Definition at line 194 of file PanelSecondaryLegacyTest.php.

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

195  {
196  $legacy = $this->getUIFactory()->legacy("Legacy content");
197  $sort_options = array(
198  'a' => 'A',
199  'b' => 'B'
200  );
201  $sortation = $this->getUIFactory()->viewControl()->sortation($sort_options);
202  $sec = $this->getUIFactory()->legacyPanel("Title", $legacy)
203  ->withViewControls([$sortation]);
204 
205  $html = $this->getDefaultRenderer()->render($sec);
206 
207  $expected_html = <<<EOT
208 <div class="panel panel-secondary panel-flex">
209  <div class="panel-heading ilHeader">
210  <h4>Title</h4>
211  <div class="il-viewcontrol-sortation" id="">
212  <div class="dropdown">
213  <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-label="actions" aria-haspopup="true" aria-expanded="false">
214  <span class="caret"></span>
215  </button>
216  <ul class="dropdown-menu">
217  <li><button class="btn btn-link" data-action="?sortation=a" id="id_1">A</button></li>
218  <li><button class="btn btn-link" data-action="?sortation=b" id="id_2">B</button></li>
219  </ul>
220  </div>
221  </div>
222  </div>
223  <div class="panel-body">
224  Legacy content
225  </div>
226 </div>
227 EOT;
228  $this->assertHTMLEquals(
229  $this->cleanHTML($expected_html),
230  $this->cleanHTML($html)
231  );
232  }
Title class.
Definition: Title.php:36
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:268
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:326
+ Here is the call graph for this function:

◆ test_with_actions()

PanelSecondaryLegacyTest::test_with_actions ( )

Definition at line 84 of file PanelSecondaryLegacyTest.php.

References getUIFactory().

85  {
86  $legacy = $this->getUIFactory()->legacy("Legacy content");
87  $actions = $this->getUIFactory()->dropdown()->standard(array(
88  $this->getUIFactory()->button()->shy("ILIAS", "https://www.ilias.de"),
89  $this->getUIFactory()->button()->shy("Github", "https://www.github.com")
90  ));
91 
92  $secondary_panel = $this->getUIFactory()->legacyPanel("title", $legacy)
93  ->withActions($actions);
94 
95  $this->assertEquals($secondary_panel->getActions(), $actions);
96  }
+ Here is the call graph for this function:

◆ test_with_pagination_viewcontrol()

PanelSecondaryLegacyTest::test_with_pagination_viewcontrol ( )

Definition at line 125 of file PanelSecondaryLegacyTest.php.

References getUIFactory().

126  {
127  $legacy = $this->getUIFactory()->legacy("Legacy content");
128  $pagination = $this->getUIFactory()->viewControl()->pagination()
129  ->withTargetURL("http://ilias.de", 'page')
130  ->withTotalEntries(98)
131  ->withPageSize(10)
132  ->withCurrentPage(1);
133 
134  $secondary_panel = $this->getUIFactory()->legacyPanel("title", $legacy)
135  ->withViewControls([$pagination]);
136 
137  $array_vc = $secondary_panel->getViewControls();
138 
139  $this->assertEquals($array_vc[0], $pagination);
140  }
+ Here is the call graph for this function:

◆ test_with_section_viewcontrol()

PanelSecondaryLegacyTest::test_with_section_viewcontrol ( )

Definition at line 142 of file PanelSecondaryLegacyTest.php.

References $section, and getUIFactory().

143  {
144  $legacy = $this->getUIFactory()->legacy("Legacy content");
145  $back = $this->getUIFactory()->button()->standard("previous", "http://www.ilias.de");
146  $next = $this->getUIFactory()->button()->standard("next", "http://www.github.com");
147  $current = $this->getUIFactory()->button()->standard("current", "");
148  $section = $this->getUIFactory()->viewControl()->section($back, $current, $next);
149 
150  $secondary_panel = $this->getUIFactory()->legacyPanel("title", $legacy)
151  ->withViewControls([$section]);
152 
153  $array_vc = $secondary_panel->getViewControls();
154 
155  $this->assertEquals($array_vc[0], $section);
156  }
$section
Definition: Utf8Test.php:83
+ Here is the call graph for this function:

◆ test_with_sortation_viewcontrol()

PanelSecondaryLegacyTest::test_with_sortation_viewcontrol ( )

Definition at line 107 of file PanelSecondaryLegacyTest.php.

References getUIFactory().

108  {
109  $legacy = $this->getUIFactory()->legacy("Legacy content");
110  $sort_options = array(
111  'internal_rating' => 'Best',
112  'date_desc' => 'Most Recent',
113  'date_asc' => 'Oldest',
114  );
115  $sortation = $this->getUIFactory()->viewControl()->sortation($sort_options);
116 
117  $secondary_panel = $this->getUIFactory()->legacyPanel("title", $legacy)
118  ->withViewControls([$sortation]);
119 
120  $array_vc = $secondary_panel->getViewControls();
121 
122  $this->assertEquals($array_vc[0], $sortation);
123  }
+ Here is the call graph for this function:

◆ test_without_viewcontrols()

PanelSecondaryLegacyTest::test_without_viewcontrols ( )

Definition at line 98 of file PanelSecondaryLegacyTest.php.

References getUIFactory().

99  {
100  $legacy = $this->getUIFactory()->legacy("Legacy content");
101  $secondary_panel = $this->getUIFactory()->legacyPanel("title", $legacy);
102  $array_vc = $secondary_panel->getViewControls();
103 
104  $this->assertEquals($array_vc, null);
105  }
+ Here is the call graph for this function:

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