ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
PanelTest Class Reference

Test on button implementation. More...

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

Public Member Functions

 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 ()
 
- 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 26 of file PanelTest.php.

Member Function Documentation

◆ getPanelFactory()

PanelTest::getPanelFactory ( )
Returns
\ILIAS\UI\Implementation\Component\Panel\Factory

Definition at line 32 of file PanelTest.php.

33 {
34 return new I\Component\Panel\Factory(
35 $this->createMock(C\Panel\Listing\Factory::class)
36 );
37 }

Referenced by test_implements_factory_interface(), test_render_report(), test_render_standard(), test_render_sub(), test_report_get_content(), test_report_get_title(), test_standard_get_content(), test_standard_get_title(), test_standard_with_actions(), test_sub_with_actions(), and test_sub_with_card().

+ Here is the caller graph for this function:

◆ test_implements_factory_interface()

PanelTest::test_implements_factory_interface ( )

Definition at line 39 of file PanelTest.php.

40 {
41 $f = $this->getPanelFactory();
42
43 $this->assertInstanceOf("ILIAS\\UI\\Component\\Panel\\Factory", $f);
44 $this->assertInstanceOf(
45 "ILIAS\\UI\\Component\\Panel\\Standard",
46 $f->standard("Title", array(new ComponentDummy()))
47 );
48 $this->assertInstanceOf(
49 "ILIAS\\UI\\Component\\Panel\\Sub",
50 $f->sub("Title", array(new ComponentDummy()))
51 );
52 $this->assertInstanceOf(
53 "ILIAS\\UI\\Component\\Panel\\Report",
54 $f->report("Title", $f->sub("Title", array(new ComponentDummy())))
55 );
56 }
getPanelFactory()
Definition: PanelTest.php:32

References $f, and getPanelFactory().

+ Here is the call graph for this function:

◆ test_render_report()

PanelTest::test_render_report ( )

Definition at line 214 of file PanelTest.php.

215 {
216 $fp = $this->getPanelFactory();
217 $r = $this->getDefaultRenderer();
218 $sub = $fp->sub("Title", array());
219 $card = new I\Component\Card\Card("Card Title");
220 $sub = $sub->withCard($card);
221 $report = $fp->report("Title", $sub);
222
223 $html = $r->render($report);
224
225 $expected_html =
226 "<div class=\"panel panel-primary il-panel-report\">" .
227 " <div class=\"panel-heading ilHeader\">" .
228 "<h3 class=\"ilHeader\">Title</h3>" .
229 " </div>" .
230 " <div class=\"panel-body\">" .
231 "
232 <div class=\"panel panel-primary\">" .
233 " <div class=\"panel-heading ilBlockHeader clearfix\">" .
234 " <h4>Title</h4>" .
235 " </div>" .
236 " <div class=\"panel-body\"><div class=\"row\">" .
237 " <div class=\"col-sm-8\"></div>" .
238 " <div class=\"col-sm-4\">" .
239 " <div class=\"il-card thumbnail\"><div class=\"card-no-highlight\"></div><div class=\"caption\"><h5 class=\"card-title\">Card Title</h5></div></div>" .
240 " </div>" .
241 " </div></div>" .
242 " </div>" .
243 " </div>" .
244 "</div>";
245
246 $this->assertHTMLEquals($expected_html, $html);
247 }
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:270
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
$html
Definition: example_001.php:87
$r
Definition: example_031.php:79

References $html, $r, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\getDefaultRenderer(), and getPanelFactory().

+ Here is the call graph for this function:

◆ test_render_standard()

PanelTest::test_render_standard ( )

Definition at line 139 of file PanelTest.php.

140 {
141 $f = $this->getPanelFactory();
142 $r = $this->getDefaultRenderer();
143
144 $actions = new I\Component\Dropdown\Standard(array(
145 new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
146 new I\Component\Button\Shy("GitHub", "https://www.github.com")
147 ));
148
149 $p = $f->standard("Title", array())->withActions($actions);
150
151 $html = $r->render($p);
152
153 $expected_html = <<<EOT
154<div class="panel panel-primary">
155 <div class="panel-heading ilHeader clearfix">
156 <h3 class="ilHeader">Title</h3>
157 <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>
158 <ul 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 class="panel-body"></div>
165</div>
166EOT;
167 $this->assertHTMLEquals($expected_html, $html);
168 }
Title class.
Definition: Title.php:37
Class BaseForm.
$this data['403_header']

References $f, $html, $r, ILIAS_UI_TestBase\assertHTMLEquals(), data, ILIAS_UI_TestBase\getDefaultRenderer(), and getPanelFactory().

+ Here is the call graph for this function:

◆ test_render_sub()

PanelTest::test_render_sub ( )

Definition at line 170 of file PanelTest.php.

171 {
172 $fp = $this->getPanelFactory();
173 $r = $this->getDefaultRenderer();
174
175 $actions = new I\Component\Dropdown\Standard(array(
176 new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
177 new I\Component\Button\Shy("GitHub", "https://www.github.com")
178 ));
179
180 $p = $fp->sub("Title", array())->withActions($actions);
181 $card = new I\Component\Card\Card("Card Title");
182 $p = $p->withCard($card);
183 $html = $r->render($p);
184
185 $expected_html = <<<EOT
186<div class="panel panel-primary">
187 <div class="panel-heading ilBlockHeader clearfix">
188 <h4>Title</h4>
189 <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>
190 <ul class="dropdown-menu">
191 <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
192 <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button></li>
193 </ul>
194 </div>
195 </div>
196 <div class="panel-body">
197 <div class="row">
198 <div class="col-sm-8"></div>
199 <div class="col-sm-4">
200 <div class="il-card thumbnail">
201 <div class="card-no-highlight"></div>
202 <div class="caption">
203 <h5 class="card-title">Card Title</h5>
204 </div>
205 </div>
206 </div>
207 </div>
208 </div>
209</div>
210EOT;
211
212 $this->assertHTMLEquals($expected_html, $html);
213 }

References $html, $r, ILIAS_UI_TestBase\assertHTMLEquals(), data, ILIAS_UI_TestBase\getDefaultRenderer(), and getPanelFactory().

+ Here is the call graph for this function:

◆ test_report_get_content()

PanelTest::test_report_get_content ( )

Definition at line 129 of file PanelTest.php.

130 {
131 $f = $this->getPanelFactory();
132 $sub = $f->sub("Title", array(new ComponentDummy()));
133 $p = $f->report("Title", $sub);
134
135 $this->assertEquals($p->getContent(), array($sub));
136 }

References $f, and getPanelFactory().

+ Here is the call graph for this function:

◆ test_report_get_title()

PanelTest::test_report_get_title ( )

Definition at line 120 of file PanelTest.php.

121 {
122 $f = $this->getPanelFactory();
123 $sub = $f->sub("Title", array(new ComponentDummy()));
124 $p = $f->report("Title", array($sub));
125
126 $this->assertEquals($p->getTitle(), "Title");
127 }

References $f, and getPanelFactory().

+ Here is the call graph for this function:

◆ test_standard_get_content()

PanelTest::test_standard_get_content ( )

Definition at line 66 of file PanelTest.php.

67 {
68 $f = $this->getPanelFactory();
69 $c = new ComponentDummy();
70 $p = $f->standard("Title", array($c));
71
72 $this->assertEquals($p->getContent(), array($c));
73 }

References $c, $f, and getPanelFactory().

+ Here is the call graph for this function:

◆ test_standard_get_title()

PanelTest::test_standard_get_title ( )

Definition at line 58 of file PanelTest.php.

59 {
60 $f = $this->getPanelFactory();
61 $p = $f->standard("Title", array(new ComponentDummy()));
62
63 $this->assertEquals($p->getTitle(), "Title");
64 }

References $f, and getPanelFactory().

+ Here is the call graph for this function:

◆ test_standard_with_actions()

PanelTest::test_standard_with_actions ( )

Definition at line 75 of file PanelTest.php.

76 {
77 $fp = $this->getPanelFactory();
78
79 $p = $fp->standard("Title", array(new ComponentDummy()));
80
81 $actions = new I\Component\Dropdown\Standard(array(
82 new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
83 new I\Component\Button\Shy("GitHub", "https://www.github.com")
84 ));
85
86 $p = $p->withActions($actions);
87
88 $this->assertEquals($p->getActions(), $actions);
89 }

References getPanelFactory().

+ Here is the call graph for this function:

◆ test_sub_with_actions()

PanelTest::test_sub_with_actions ( )

Definition at line 91 of file PanelTest.php.

92 {
93 $fp = $this->getPanelFactory();
94
95 $p = $fp->sub("Title", array(new ComponentDummy()));
96
97 $actions = new I\Component\Dropdown\Standard(array(
98 new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
99 new I\Component\Button\Shy("GitHub", "https://www.github.com")
100 ));
101
102 $p = $p->withActions($actions);
103
104 $this->assertEquals($p->getActions(), $actions);
105 }

References getPanelFactory().

+ Here is the call graph for this function:

◆ test_sub_with_card()

PanelTest::test_sub_with_card ( )

Definition at line 107 of file PanelTest.php.

108 {
109 $fp = $this->getPanelFactory();
110
111 $p = $fp->sub("Title", array(new ComponentDummy()));
112
113 $card = new I\Component\Card\Card("Card Title");
114
115 $p = $p->withCard($card);
116
117 $this->assertEquals($p->getCard(), $card);
118 }

References getPanelFactory().

+ Here is the call graph for this function:

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