ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
PanelTest Class Reference

Test on button implementation. More...

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

Public Member Functions

 getPanelFactory ()
 
 getFactory ()
 
 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 ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Detailed Description

Test on button implementation.

Definition at line 25 of file PanelTest.php.

Member Function Documentation

◆ getFactory()

PanelTest::getFactory ( )
Returns

Definition at line 39 of file PanelTest.php.

40  {
41  return new \ILIAS\UI\Implementation\Factory();
42  }

◆ getPanelFactory()

PanelTest::getPanelFactory ( )
Returns

Definition at line 31 of file PanelTest.php.

32  {
33  return new \ILIAS\UI\Implementation\Component\Panel\Factory();
34  }

◆ test_implements_factory_interface()

PanelTest::test_implements_factory_interface ( )

Definition at line 44 of file PanelTest.php.

References array.

45  {
46  $f = $this->getPanelFactory();
47 
48  $this->assertInstanceOf("ILIAS\\UI\\Component\\Panel\\Factory", $f);
49  $this->assertInstanceOf(
50  "ILIAS\\UI\\Component\\Panel\\Standard",
51  $f->standard("Title", array(new ComponentDummy()))
52  );
53  $this->assertInstanceOf(
54  "ILIAS\\UI\\Component\\Panel\\Sub",
55  $f->sub("Title", array(new ComponentDummy()))
56  );
57  $this->assertInstanceOf(
58  "ILIAS\\UI\\Component\\Panel\\Report",
59  $f->report("Title", $f->sub("Title", array(new ComponentDummy())))
60  );
61  }
getPanelFactory()
Definition: PanelTest.php:31
Create styles array
The data for the language used.

◆ test_render_report()

PanelTest::test_render_report ( )

Definition at line 223 of file PanelTest.php.

References $html, $r, and array.

224  {
225  $f = $this->getFactory();
226  $fp = $this->getPanelFactory();
227  $r = $this->getDefaultRenderer();
228  $sub = $fp->sub("Title", array());
229  $card = $f->card("Card Title");
230  $sub = $sub->withCard($card);
231  $report = $fp->report("Title", $sub);
232 
233  $html = $r->render($report);
234 
235  $expected_html =
236  "<div class=\"panel panel-primary il-panel-report\">" .
237  " <div class=\"panel-heading ilHeader\">" .
238  "<h3 class=\"ilHeader\">Title</h3>" .
239  " </div>" .
240  " <div class=\"panel-body\">" .
241  "
242  <div class=\"panel panel-primary\">" .
243  " <div class=\"panel-heading ilBlockHeader clearfix\">" .
244  " <h4>Title</h4>" .
245  " </div>" .
246  " <div class=\"panel-body\"><div class=\"row\">" .
247  " <div class=\"col-sm-8\"></div>" .
248  " <div class=\"col-sm-4\">" .
249  " <div class=\"il-card thumbnail\"><div class=\"card-no-highlight\"></div><div class=\"caption\"><h5 class=\"card-title\">Card Title</h5></div></div>" .
250  " </div>" .
251  " </div></div>" .
252  " </div>" .
253  " </div>" .
254  "</div>";
255 
256  $this->assertHTMLEquals($expected_html, $html);
257  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
getFactory()
Definition: PanelTest.php:39
getPanelFactory()
Definition: PanelTest.php:31
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:252
Create styles array
The data for the language used.
$html
Definition: example_001.php:87

◆ test_render_standard()

PanelTest::test_render_standard ( )

Definition at line 147 of file PanelTest.php.

References $html, $r, array, and data.

148  {
149  $f = $this->getFactory();
150  $r = $this->getDefaultRenderer();
151 
152  $actions = $f->dropdown()->standard(array(
153  $f->button()->shy("ILIAS", "https://www.ilias.de"),
154  $f->button()->shy("GitHub", "https://www.github.com")
155  ));
156 
157  $p = $f->panel()->standard("Title", array())->withActions($actions);
158 
159  $html = $r->render($p);
160 
161  $expected_html = <<<EOT
162 <div class="panel panel-primary">
163  <div class="panel-heading ilHeader clearfix">
164  <h3 class="ilHeader">Title</h3>
165  <div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="caret"></span></button>
166  <ul class="dropdown-menu">
167  <li><a class="btn btn-link" href="https://www.ilias.de" data-action="https://www.ilias.de">ILIAS</a></li>
168  <li><a class="btn btn-link" href="https://www.github.com" data-action="https://www.github.com">GitHub</a></li>
169  </ul>
170  </div>
171  </div>
172  <div class="panel-body"></div>
173 </div>
174 EOT;
175  $this->assertHTMLEquals($expected_html, $html);
176  }
Add some data
Class BaseForm.
Title class.
Definition: Title.php:36
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
getFactory()
Definition: PanelTest.php:39
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:252
Create styles array
The data for the language used.
$html
Definition: example_001.php:87

◆ test_render_sub()

PanelTest::test_render_sub ( )

Definition at line 178 of file PanelTest.php.

References $html, $r, array, and data.

179  {
180  $f = $this->getFactory();
181  $fp = $this->getPanelFactory();
182  $r = $this->getDefaultRenderer();
183 
184  $actions = $f->dropdown()->standard(array(
185  $f->button()->shy("ILIAS", "https://www.ilias.de"),
186  $f->button()->shy("GitHub", "https://www.github.com")
187  ));
188 
189  $p = $fp->sub("Title", array())->withActions($actions);
190  $card = $f->card("Card Title");
191  $p = $p->withCard($card);
192  $html = $r->render($p);
193 
194  $expected_html = <<<EOT
195 <div class="panel panel-primary">
196  <div class="panel-heading ilBlockHeader clearfix">
197  <h4>Title</h4>
198  <div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="caret"></span></button>
199  <ul class="dropdown-menu">
200  <li><a class="btn btn-link" href="https://www.ilias.de" data-action="https://www.ilias.de">ILIAS</a></li>
201  <li><a class="btn btn-link" href="https://www.github.com" data-action="https://www.github.com">GitHub</a></li>
202  </ul>
203  </div>
204  </div>
205  <div class="panel-body">
206  <div class="row">
207  <div class="col-sm-8"></div>
208  <div class="col-sm-4">
209  <div class="il-card thumbnail">
210  <div class="card-no-highlight"></div>
211  <div class="caption">
212  <h5 class="card-title">Card Title</h5>
213  </div>
214  </div>
215  </div>
216  </div>
217  </div>
218 </div>
219 EOT;
220 
221  $this->assertHTMLEquals($expected_html, $html);
222  }
Add some data
Class BaseForm.
Title class.
Definition: Title.php:36
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
getFactory()
Definition: PanelTest.php:39
getPanelFactory()
Definition: PanelTest.php:31
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:252
Create styles array
The data for the language used.
$html
Definition: example_001.php:87

◆ test_report_get_content()

PanelTest::test_report_get_content ( )

Definition at line 137 of file PanelTest.php.

References array.

138  {
139  $f = $this->getPanelFactory();
140  $sub = $f->sub("Title", array(new ComponentDummy()));
141  $p = $f->report("Title", $sub);
142 
143  $this->assertEquals($p->getContent(), array($sub));
144  }
getPanelFactory()
Definition: PanelTest.php:31
Create styles array
The data for the language used.

◆ test_report_get_title()

PanelTest::test_report_get_title ( )

Definition at line 128 of file PanelTest.php.

References array.

129  {
130  $f = $this->getPanelFactory();
131  $sub = $f->sub("Title", array(new ComponentDummy()));
132  $p = $f->report("Title", array($sub));
133 
134  $this->assertEquals($p->getTitle(), "Title");
135  }
getPanelFactory()
Definition: PanelTest.php:31
Create styles array
The data for the language used.

◆ test_standard_get_content()

PanelTest::test_standard_get_content ( )

Definition at line 71 of file PanelTest.php.

References array.

72  {
73  $f = $this->getPanelFactory();
74  $c = new ComponentDummy();
75  $p = $f->standard("Title", array($c));
76 
77  $this->assertEquals($p->getContent(), array($c));
78  }
getPanelFactory()
Definition: PanelTest.php:31
Create styles array
The data for the language used.

◆ test_standard_get_title()

PanelTest::test_standard_get_title ( )

Definition at line 63 of file PanelTest.php.

References array.

64  {
65  $f = $this->getPanelFactory();
66  $p = $f->standard("Title", array(new ComponentDummy()));
67 
68  $this->assertEquals($p->getTitle(), "Title");
69  }
getPanelFactory()
Definition: PanelTest.php:31
Create styles array
The data for the language used.

◆ test_standard_with_actions()

PanelTest::test_standard_with_actions ( )

Definition at line 80 of file PanelTest.php.

References array.

81  {
82  $fp = $this->getPanelFactory();
83  $f = $this->getFactory();
84 
85  $p = $fp->standard("Title", array(new ComponentDummy()));
86 
87  $actions = $f->dropdown()->standard(array(
88  $f->button()->shy("ILIAS", "https://www.ilias.de"),
89  $f->button()->shy("GitHub", "https://www.github.com")
90  ));
91 
92  $p = $p->withActions($actions);
93 
94  $this->assertEquals($p->getActions(), $actions);
95  }
getFactory()
Definition: PanelTest.php:39
getPanelFactory()
Definition: PanelTest.php:31
Create styles array
The data for the language used.

◆ test_sub_with_actions()

PanelTest::test_sub_with_actions ( )

Definition at line 97 of file PanelTest.php.

References array.

98  {
99  $fp = $this->getPanelFactory();
100  $f = $this->getFactory();
101 
102  $p = $fp->sub("Title", array(new ComponentDummy()));
103 
104  $actions = $f->dropdown()->standard(array(
105  $f->button()->shy("ILIAS", "https://www.ilias.de"),
106  $f->button()->shy("GitHub", "https://www.github.com")
107  ));
108 
109  $p = $p->withActions($actions);
110 
111  $this->assertEquals($p->getActions(), $actions);
112  }
getFactory()
Definition: PanelTest.php:39
getPanelFactory()
Definition: PanelTest.php:31
Create styles array
The data for the language used.

◆ test_sub_with_card()

PanelTest::test_sub_with_card ( )

Definition at line 114 of file PanelTest.php.

References array.

115  {
116  $fp = $this->getPanelFactory();
117  $f = $this->getFactory();
118 
119  $p = $fp->sub("Title", array(new ComponentDummy()));
120 
121  $card = $f->card("Card Title");
122 
123  $p = $p->withCard($card);
124 
125  $this->assertEquals($p->getCard(), $card);
126  }
getFactory()
Definition: PanelTest.php:39
getPanelFactory()
Definition: PanelTest.php:31
Create styles array
The data for the language used.

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