ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
PanelTest Class Reference

Test on button implementation. More...

+ Inheritance diagram for PanelTest:
+ Collaboration diagram for PanelTest:

Public Member Functions

 getUIFactory ()
 
 getPanelFactory ()
 
 test_implements_factory_interface ()
 
 test_standard_get_title ()
 
 test_standard_get_content ()
 
 test_standard_with_actions ()
 
 test_sub_with_actions ()
 
 test_sub_with_card ()
 
 test_report_get_title ()
 
 test_report_get_content ()
 
 test_render_standard ()
 
 test_render_sub ()
 
 test_render_report ()
 
 test_with_view_controls ()
 
 test_render_with_sortation ()
 
 test_render_with_pagination ()
 
- 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)
 

Additional Inherited Members

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

Detailed Description

Test on button implementation.

Definition at line 27 of file PanelTest.php.

Member Function Documentation

◆ getPanelFactory()

PanelTest::getPanelFactory ( )
Returns

Definition at line 63 of file PanelTest.php.

64  {
65  return new I\Component\Panel\Factory(
66  $this->createMock(C\Panel\Listing\Factory::class)
67  );
68  }

◆ getUIFactory()

PanelTest::getUIFactory ( )

Definition at line 29 of file PanelTest.php.

References $factory.

30  {
31  $factory = new class extends NoUIFactory {
32  public function panelSecondary()
33  {
34  return new I\Component\Panel\Secondary\Factory();
35  }
36  public function dropdown()
37  {
38  return new I\Component\Dropdown\Factory();
39  }
40  public function viewControl()
41  {
42  return new I\Component\ViewControl\Factory(new SignalGenerator());
43  }
44  public function button()
45  {
46  return new I\Component\Button\Factory();
47  }
48  public function symbol() : C\Symbol\Factory
49  {
50  return new I\Component\Symbol\Factory(
51  new I\Component\Symbol\Icon\Factory(),
52  new I\Component\Symbol\Glyph\Factory(),
53  new I\Component\Symbol\Avatar\Factory()
54  );
55  }
56  };
57  return $factory;
58  }
$factory
Definition: metadata.php:58

◆ test_implements_factory_interface()

PanelTest::test_implements_factory_interface ( )

Definition at line 70 of file PanelTest.php.

References Vendor\Package\$f.

71  {
72  $f = $this->getPanelFactory();
73 
74  $this->assertInstanceOf("ILIAS\\UI\\Component\\Panel\\Factory", $f);
75  $this->assertInstanceOf(
76  "ILIAS\\UI\\Component\\Panel\\Standard",
77  $f->standard("Title", array(new ComponentDummy()))
78  );
79  $this->assertInstanceOf(
80  "ILIAS\\UI\\Component\\Panel\\Sub",
81  $f->sub("Title", array(new ComponentDummy()))
82  );
83  $this->assertInstanceOf(
84  "ILIAS\\UI\\Component\\Panel\\Report",
85  $f->report("Title", $f->sub("Title", array(new ComponentDummy())))
86  );
87  }
getPanelFactory()
Definition: PanelTest.php:63

◆ test_render_report()

PanelTest::test_render_report ( )

Definition at line 244 of file PanelTest.php.

245  {
246  $fp = $this->getPanelFactory();
247  $r = $this->getDefaultRenderer();
248  $sub = $fp->sub("Title", array());
249  $card = new I\Component\Card\Card("Card Title");
250  $sub = $sub->withCard($card);
251  $report = $fp->report("Title", $sub);
252 
253  $html = $r->render($report);
254 
255  $expected_html = <<<EOT
256 <div class="panel panel-primary il-panel-report panel-flex">
257  <div class="panel-heading ilHeader">
258  <h3>Title</h3>
259  </div>
260  <div class="panel-body">
261  <div class="panel panel-sub panel-flex">
262  <div class="panel-heading ilBlockHeader">
263  <h3>Title</h3>
264  </div>
265  <div class="panel-body"><div class="row">
266  <div class="col-sm-8"></div>
267  <div class="col-sm-4">
268  <div class="il-card thumbnail">
269  <div class="card-no-highlight"></div>
270  <div class="caption">
271  <div class="card-title">Card Title</div>
272  </div>
273  </div>
274  </div>
275  </div>
276  </div>
277  </div>
278  </div>
279 </div>
280 EOT;
281 
282  $this->assertHTMLEquals($expected_html, $html);
283  }
Title class.
Definition: Title.php:36
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:268
getPanelFactory()
Definition: PanelTest.php:63
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:326

◆ test_render_standard()

PanelTest::test_render_standard ( )

Definition at line 168 of file PanelTest.php.

References Vendor\Package\$f.

169  {
170  $f = $this->getPanelFactory();
171  $r = $this->getDefaultRenderer();
172 
173  $actions = new I\Component\Dropdown\Standard(array(
174  new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
175  new I\Component\Button\Shy("GitHub", "https://www.github.com")
176  ));
177 
178  $p = $f->standard("Title", array())->withActions($actions);
179 
180  $html = $r->render($p);
181 
182  $expected_html = <<<EOT
183 <div class="panel panel-primary panel-flex">
184  <div class="panel-heading ilHeader">
185  <h2>Title</h2>
186  <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>
187  <ul class="dropdown-menu">
188  <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
189  <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button></li>
190  </ul>
191  </div>
192  </div>
193  <div class="panel-body"></div>
194 </div>
195 EOT;
196  $this->assertHTMLEquals($expected_html, $html);
197  }
Class ChatMainBarProvider .
Title class.
Definition: Title.php:36
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:268
getPanelFactory()
Definition: PanelTest.php:63
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:326

◆ test_render_sub()

PanelTest::test_render_sub ( )

Definition at line 199 of file PanelTest.php.

200  {
201  $fp = $this->getPanelFactory();
202  $r = $this->getDefaultRenderer();
203 
204  $actions = new I\Component\Dropdown\Standard(array(
205  new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
206  new I\Component\Button\Shy("GitHub", "https://www.github.com")
207  ));
208 
209  $p = $fp->sub("Title", array())->withActions($actions);
210  $card = new I\Component\Card\Card("Card Title");
211  $p = $p->withCard($card);
212  $html = $r->render($p);
213 
214  $expected_html = <<<EOT
215 <div class="panel panel-sub panel-flex">
216  <div class="panel-heading ilBlockHeader">
217  <h3>Title</h3>
218  <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>
219  <ul class="dropdown-menu">
220  <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
221  <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button></li>
222  </ul>
223  </div>
224  </div>
225  <div class="panel-body">
226  <div class="row">
227  <div class="col-sm-8"></div>
228  <div class="col-sm-4">
229  <div class="il-card thumbnail">
230  <div class="card-no-highlight"></div>
231  <div class="caption">
232  <div class="card-title">Card Title</div>
233  </div>
234  </div>
235  </div>
236  </div>
237  </div>
238 </div>
239 EOT;
240 
241  $this->assertHTMLEquals($expected_html, $html);
242  }
Class ChatMainBarProvider .
Title class.
Definition: Title.php:36
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:268
getPanelFactory()
Definition: PanelTest.php:63
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:326

◆ test_render_with_pagination()

PanelTest::test_render_with_pagination ( )

Definition at line 339 of file PanelTest.php.

References Vendor\Package\$f, and disabled().

340  {
341  $pagination = $this->getUIFactory()->viewControl()->pagination()
342  ->withTargetURL('http://ilias.de', 'page')
343  ->withTotalEntries(10)
344  ->withPageSize(2)
345  ->withCurrentPage(1);
346 
347  $f = $this->getPanelFactory();
348  $r = $this->getDefaultRenderer();
349 
350 
351  $p = $f->standard("Title", [])
352  ->withViewControls([$pagination]);
353 
354  $html = $r->render($p);
355 
356  $expected_html = <<<EOT
357 <div class="panel panel-primary panel-flex">
358  <div class="panel-heading ilHeader">
359  <h2>Title</h2>
360  <div class="il-viewcontrol-pagination">
361 <span class="browse previous"><a class="glyph" href="http://ilias.de?page=0" aria-label="back">
362 <span class="glyphicon
363  glyphicon-chevron-left
364 " aria-hidden="true"></span>
365 </a>
366 </span>
367  <button class="btn btn-link" data-action="http://ilias.de?page=0" id="id_1">1</button>
368  <button class="btn btn-link" data-action="http://ilias.de?page=1" disabled="disabled">2</button>
369  <button class="btn btn-link" data-action="http://ilias.de?page=2" id="id_2">3</button>
370  <button class="btn btn-link" data-action="http://ilias.de?page=3" id="id_3">4</button>
371  <button class="btn btn-link" data-action="http://ilias.de?page=4" id="id_4">5</button>
372 <span class="browse next"><a class="glyph" href="http://ilias.de?page=2" aria-label="next">
373 <span class="glyphicon
374  glyphicon-chevron-right
375 " aria-hidden="true"></span>
376 </a>
377 </span>
378 </div>
379 
380  </div>
381  <div class="panel-body"></div>
382 </div>
383 EOT;
384  $this->assertHTMLEquals($expected_html, $html);
385  }
Title class.
Definition: Title.php:36
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:268
getPanelFactory()
Definition: PanelTest.php:63
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
getUIFactory()
Definition: PanelTest.php:29
+ Here is the call graph for this function:

◆ test_render_with_sortation()

PanelTest::test_render_with_sortation ( )

Definition at line 300 of file PanelTest.php.

References Vendor\Package\$f.

301  {
302  $sort_options = [
303  'a' => 'A',
304  'b' => 'B'
305  ];
306  $sortation = $this->getUIFactory()->viewControl()->sortation($sort_options);
307 
308  $f = $this->getPanelFactory();
309  $r = $this->getDefaultRenderer();
310 
311 
312  $p = $f->standard("Title", [])
313  ->withViewControls([$sortation]);
314  ;
315 
316  $html = $r->render($p);
317 
318  $expected_html = <<<EOT
319 <div class="panel panel-primary panel-flex">
320  <div class="panel-heading ilHeader">
321  <h2>Title</h2>
322  <div class="il-viewcontrol-sortation" id="">
323 <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>
324 <ul class="dropdown-menu">
325  <li><button class="btn btn-link" data-action="?sortation=a" id="id_1">A</button>
326 </li>
327  <li><button class="btn btn-link" data-action="?sortation=b" id="id_2">B</button>
328 </li>
329 </ul>
330 </div>
331 </div>
332  </div>
333  <div class="panel-body"></div>
334 </div>
335 EOT;
336  $this->assertHTMLEquals($expected_html, $html);
337  }
Title class.
Definition: Title.php:36
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:268
getPanelFactory()
Definition: PanelTest.php:63
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:326
getUIFactory()
Definition: PanelTest.php:29

◆ test_report_get_content()

PanelTest::test_report_get_content ( )

Definition at line 160 of file PanelTest.php.

References Vendor\Package\$f.

161  {
162  $f = $this->getPanelFactory();
163  $sub = $f->sub("Title", array(new ComponentDummy()));
164  $p = $f->report("Title", $sub);
165 
166  $this->assertEquals($p->getContent(), array($sub));
167  }
getPanelFactory()
Definition: PanelTest.php:63

◆ test_report_get_title()

PanelTest::test_report_get_title ( )

Definition at line 151 of file PanelTest.php.

References Vendor\Package\$f.

152  {
153  $f = $this->getPanelFactory();
154  $sub = $f->sub("Title", array(new ComponentDummy()));
155  $p = $f->report("Title", array($sub));
156 
157  $this->assertEquals($p->getTitle(), "Title");
158  }
getPanelFactory()
Definition: PanelTest.php:63

◆ test_standard_get_content()

PanelTest::test_standard_get_content ( )

Definition at line 97 of file PanelTest.php.

References Vendor\Package\$c, and Vendor\Package\$f.

98  {
99  $f = $this->getPanelFactory();
100  $c = new ComponentDummy();
101  $p = $f->standard("Title", array($c));
102 
103  $this->assertEquals($p->getContent(), array($c));
104  }
getPanelFactory()
Definition: PanelTest.php:63

◆ test_standard_get_title()

PanelTest::test_standard_get_title ( )

Definition at line 89 of file PanelTest.php.

References Vendor\Package\$f.

90  {
91  $f = $this->getPanelFactory();
92  $p = $f->standard("Title", array(new ComponentDummy()));
93 
94  $this->assertEquals($p->getTitle(), "Title");
95  }
getPanelFactory()
Definition: PanelTest.php:63

◆ test_standard_with_actions()

PanelTest::test_standard_with_actions ( )

Definition at line 106 of file PanelTest.php.

107  {
108  $fp = $this->getPanelFactory();
109 
110  $p = $fp->standard("Title", array(new ComponentDummy()));
111 
112  $actions = new I\Component\Dropdown\Standard(array(
113  new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
114  new I\Component\Button\Shy("GitHub", "https://www.github.com")
115  ));
116 
117  $p = $p->withActions($actions);
118 
119  $this->assertEquals($p->getActions(), $actions);
120  }
getPanelFactory()
Definition: PanelTest.php:63

◆ test_sub_with_actions()

PanelTest::test_sub_with_actions ( )

Definition at line 122 of file PanelTest.php.

123  {
124  $fp = $this->getPanelFactory();
125 
126  $p = $fp->sub("Title", array(new ComponentDummy()));
127 
128  $actions = new I\Component\Dropdown\Standard(array(
129  new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
130  new I\Component\Button\Shy("GitHub", "https://www.github.com")
131  ));
132 
133  $p = $p->withActions($actions);
134 
135  $this->assertEquals($p->getActions(), $actions);
136  }
getPanelFactory()
Definition: PanelTest.php:63

◆ test_sub_with_card()

PanelTest::test_sub_with_card ( )

Definition at line 138 of file PanelTest.php.

139  {
140  $fp = $this->getPanelFactory();
141 
142  $p = $fp->sub("Title", array(new ComponentDummy()));
143 
144  $card = new I\Component\Card\Card("Card Title");
145 
146  $p = $p->withCard($card);
147 
148  $this->assertEquals($p->getCard(), $card);
149  }
getPanelFactory()
Definition: PanelTest.php:63

◆ test_with_view_controls()

PanelTest::test_with_view_controls ( )

Definition at line 285 of file PanelTest.php.

References Vendor\Package\$f.

286  {
287  $sort_options = [
288  'a' => 'A',
289  'b' => 'B'
290  ];
291  $sortation = $this->getUIFactory()->viewControl()->sortation($sort_options);
292  $f = $this->getPanelFactory();
293  $p = $f->standard("Title", [])
294  ->withViewControls([$sortation]);
295  ;
296 
297  $this->assertEquals($p->getViewControls(), [$sortation]);
298  }
getPanelFactory()
Definition: PanelTest.php:63
getUIFactory()
Definition: PanelTest.php:29

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