ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ItemTest Class Reference

Test items. More...

+ Inheritance diagram for ItemTest:
+ Collaboration diagram for ItemTest:

Public Member Functions

 getFactory ()
 
 test_implements_factory_interface ()
 
 test_get_title ()
 
 test_with_description ()
 
 test_with_properties ()
 
 test_with_actions ()
 
 test_with_color ()
 
 test_with_lead_image ()
 
 test_with_lead_icon ()
 
 test_with_lead_text ()
 
 test_with_no_lead ()
 
 test_render_base ()
 
 test_render_lead_image ()
 
 test_render_lead_icon ()
 
 test_render_lead_text_and_color ()
 
 test_shy_title_and_property ()
 
 test_link_title ()
 
- 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 items.

Definition at line 14 of file ItemTest.php.

Member Function Documentation

◆ getFactory()

◆ test_get_title()

ItemTest::test_get_title ( )

Definition at line 32 of file ItemTest.php.

33 {
34 $f = $this->getFactory();
35 $c = $f->standard("title");
36
37 $this->assertEquals($c->getTitle(), "title");
38 }
getFactory()
Definition: ItemTest.php:20

References Vendor\Package\$c, Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ test_implements_factory_interface()

ItemTest::test_implements_factory_interface ( )

Definition at line 25 of file ItemTest.php.

26 {
27 $f = $this->getFactory();
28
29 $this->assertInstanceOf("ILIAS\\UI\\Component\\Item\\Standard", $f->standard("title"));
30 }

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

+ Here is the call graph for this function:

◆ test_link_title()

ItemTest::test_link_title ( )

Definition at line 318 of file ItemTest.php.

319 {
320 $f = $this->getFactory();
321 $r = $this->getDefaultRenderer();
322
323 $c = $f->standard(new I\Component\Link\Standard("ILIAS", "https://www.ilias.de"));
324 $html = $r->render($c);
325
326 $expected = <<<EOT
327<div class="il-item il-std-item "><div class="il-item-title"><a href="https://www.ilias.de">ILIAS</a></div></div>
328EOT;
329
330 $this->assertHTMLEquals($expected, $html);
331 }
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:326
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:268
Class ChatMainBarProvider \MainMenu\Provider.

References Vendor\Package\$c, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

+ Here is the call graph for this function:

◆ test_render_base()

ItemTest::test_render_base ( )

Definition at line 124 of file ItemTest.php.

125 {
126 $f = $this->getFactory();
127 $r = $this->getDefaultRenderer();
128
129 $actions = new I\Component\Dropdown\Standard(array(
130 new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
131 new I\Component\Button\Shy("GitHub", "https://www.github.com")
132 ));
133 $c = $f->standard("Item Title")
134 ->withActions($actions)
135 ->withProperties(array(
136 "Origin" => "Course Title 1",
137 "Last Update" => "24.11.2011",
138 "Location" => "Room 123, Main Street 44, 3012 Bern"))
139 ->withDescription("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.");
140
141 $html = $r->render($c);
142
143 $expected = <<<EOT
144<div class="il-item il-std-item ">
145 <div class="il-item-title">Item Title</div>
146 <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>
147<ul class="dropdown-menu">
148 <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1" >ILIAS</button>
149</li>
150 <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2" >GitHub</button>
151</li>
152</ul>
153</div>
154 <div class="il-item-description">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</div>
155 <hr class="il-item-divider" />
156 <div class="row">
157 <div class="col-md-6">
158 <div class="row">
159 <div class="col-sm-5 col-lg-4 il-item-property-name">Origin</div>
160 <div class="col-sm-7 col-lg-8 il-item-property-value il-multi-line-cap-3">Course Title 1</div>
161 </div>
162 </div>
163 <div class="col-md-6">
164 <div class="row">
165 <div class="col-sm-5 col-lg-4 il-item-property-name">Last Update</div>
166 <div class="col-sm-7 col-lg-8 il-item-property-value il-multi-line-cap-3">24.11.2011</div>
167 </div>
168 </div>
169 </div>
170 <div class="row">
171 <div class="col-md-6">
172 <div class="row">
173 <div class="col-sm-5 col-lg-4 il-item-property-name">Location</div>
174 <div class="col-sm-7 col-lg-8 il-item-property-value il-multi-line-cap-3">Room 123, Main Street 44, 3012 Bern</div>
175 </div>
176 </div>
177 <div class="col-md-6">
178 <div class="row">
179 <div class="col-sm-5 col-lg-4 il-item-property-name"></div>
180 <div class="col-sm-7 col-lg-8 il-item-property-value il-multi-line-cap-3"></div>
181 </div>
182 </div>
183 </div>
184</div>
185EOT;
186
187 $this->assertHTMLEquals(
188 $this->brutallyTrimHTML($expected),
189 $this->brutallyTrimHTML($html)
190 );
191 }
brutallyTrimHTML($html)
A more radical version of normalizeHTML.
Definition: Base.php:346
Title class.
Definition: Title.php:37

References Vendor\Package\$c, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

+ Here is the call graph for this function:

◆ test_render_lead_icon()

ItemTest::test_render_lead_icon ( )

Definition at line 222 of file ItemTest.php.

223 {
224 $f = $this->getFactory();
225 $r = $this->getDefaultRenderer();
226
227 $icon = new I\Component\Symbol\Icon\Standard("name", "aria_label", "small", false);
228
229 $c = $f->standard("title")->withLeadIcon($icon);
230
231 $html = $r->render($c);
232 $expected = <<<EOT
233<div class="il-item il-std-item ">
234 <div class="media">
235 <div class="media-left">
236 <div class="icon name small" aria-label="aria_label"></div></div>
237 <div class="media-body">
238 <div class="il-item-title">title</div>
239 </div>
240 </div>
241</div>
242EOT;
243
244 $this->assertHTMLEquals(
245 $this->brutallyTrimHTML($expected),
246 $this->brutallyTrimHTML($html)
247 );
248 }

References Vendor\Package\$c, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

+ Here is the call graph for this function:

◆ test_render_lead_image()

ItemTest::test_render_lead_image ( )

Definition at line 193 of file ItemTest.php.

194 {
195 $f = $this->getFactory();
196 $r = $this->getDefaultRenderer();
197
198 $image = new I\Component\Image\Image("standard", "src", "str");
199
200 $c = $f->standard("title")->withLeadImage($image);
201
202 $html = $r->render($c);
203 $expected = <<<EOT
204<div class="il-item il-std-item ">
205 <div class="row">
206 <div class="col-sm-3">
207 <img src="src" class="img-standard" alt="str" />
208 </div>
209 <div class="col-sm-9">
210 <div class="il-item-title">title</div>
211 </div>
212 </div>
213</div>
214EOT;
215
216 $this->assertHTMLEquals(
217 $this->brutallyTrimHTML($expected),
218 $this->brutallyTrimHTML($html)
219 );
220 }

References Vendor\Package\$c, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

+ Here is the call graph for this function:

◆ test_render_lead_text_and_color()

ItemTest::test_render_lead_text_and_color ( )

Definition at line 250 of file ItemTest.php.

251 {
252 $f = $this->getFactory();
253 $r = $this->getDefaultRenderer();
254 $df = new \ILIAS\Data\Factory();
255
256 $color = $df->color('#ff00ff');
257
258 $c = $f->standard("title")->withColor($color)->withLeadText("lead");
259
260 $html = $r->render($c);
261
262 $expected = <<<EOT
263<div class="il-item il-std-item il-item-marker " style="border-color:#ff00ff">
264 <div class="row">
265 <div class="col-sm-3">
266 lead
267 </div>
268 <div class="col-sm-9">
269 <div class="il-item-title">title</div>
270 </div>
271 </div>
272</div>
273EOT;
274
275 $this->assertHTMLEquals(
276 $this->brutallyTrimHTML($expected),
277 $this->brutallyTrimHTML($html)
278 );
279 }

References Vendor\Package\$c, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

+ Here is the call graph for this function:

◆ test_shy_title_and_property()

ItemTest::test_shy_title_and_property ( )

Definition at line 281 of file ItemTest.php.

282 {
283 $f = $this->getFactory();
284 $r = $this->getDefaultRenderer();
285 $df = new \ILIAS\Data\Factory();
286
287 $color = $df->color('#ff00ff');
288
289 $c = $f->standard(new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"))
290 ->withProperties(array("test" => new I\Component\Button\Shy("GitHub", "https://www.github.com")));
291
292 $html = $r->render($c);
293 $expected = <<<EOT
294<div class="il-item il-std-item ">
295 <div class="il-item-title"><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1" >ILIAS</button></div>
296
297 <hr class="il-item-divider" />
298 <div class="row">
299 <div class="col-md-6">
300 <div class="row">
301 <div class="col-sm-5 col-lg-4 il-item-property-name">test</div>
302 <div class="col-sm-7 col-lg-8 il-item-property-value il-multi-line-cap-3"><button class="btn btn-link" data-action="https://www.github.com" id="id_2" >GitHub</button></div>
303 </div>
304 </div>
305 <div class="col-md-6">
306 <div class="row">
307 <div class="col-sm-5 col-lg-4 il-item-property-name"></div>
308 <div class="col-sm-7 col-lg-8 il-item-property-value il-multi-line-cap-3"></div>
309 </div>
310 </div>
311 </div>
312</div>
313EOT;
314
315 $this->assertHTMLEquals($expected, $html);
316 }

References Vendor\Package\$c, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

+ Here is the call graph for this function:

◆ test_with_actions()

ItemTest::test_with_actions ( )

Definition at line 59 of file ItemTest.php.

60 {
61 $f = $this->getFactory();
62
63 $actions = new I\Component\Dropdown\Standard(array(
64 new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
65 new I\Component\Button\Shy("GitHub", "https://www.github.com")
66 ));
67 $c = $f->standard("title")->withActions($actions);
68
69 $this->assertEquals($c->getActions(), $actions);
70 }

References Vendor\Package\$c, Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ test_with_color()

ItemTest::test_with_color ( )

Definition at line 72 of file ItemTest.php.

73 {
74 $f = $this->getFactory();
75 $df = new \ILIAS\Data\Factory();
76
77 $color = $df->color('#ff00ff');
78
79 $c = $f->standard("title")->withColor($color);
80
81 $this->assertEquals($c->getColor(), $color);
82 }

References Vendor\Package\$c, Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ test_with_description()

ItemTest::test_with_description ( )

Definition at line 40 of file ItemTest.php.

41 {
42 $f = $this->getFactory();
43
44 $c = $f->standard("title")->withDescription("description");
45
46 $this->assertEquals($c->getDescription(), "description");
47 }

References Vendor\Package\$c, Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ test_with_lead_icon()

ItemTest::test_with_lead_icon ( )

Definition at line 95 of file ItemTest.php.

96 {
97 $f = $this->getFactory();
98
99 $icon = new I\Component\Symbol\Icon\Standard("name", "aria_label", "small", false);
100
101 $c = $f->standard("title")->withLeadIcon($icon);
102
103 $this->assertEquals($c->getLead(), $icon);
104 }

References Vendor\Package\$c, Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ test_with_lead_image()

ItemTest::test_with_lead_image ( )

Definition at line 84 of file ItemTest.php.

85 {
86 $f = $this->getFactory();
87
88 $image = new I\Component\Image\Image("standard", "src", "str");
89
90 $c = $f->standard("title")->withLeadImage($image);
91
92 $this->assertEquals($c->getLead(), $image);
93 }

References Vendor\Package\$c, Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ test_with_lead_text()

ItemTest::test_with_lead_text ( )

Definition at line 106 of file ItemTest.php.

107 {
108 $f = $this->getFactory();
109
110 $c = $f->standard("title")->withLeadText("text");
111
112 $this->assertEquals($c->getLead(), "text");
113 }

References Vendor\Package\$c, Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ test_with_no_lead()

ItemTest::test_with_no_lead ( )

Definition at line 115 of file ItemTest.php.

116 {
117 $f = $this->getFactory();
118
119 $c = $f->standard("title")->withLeadText("text")->withNoLead();
120
121 $this->assertEquals($c->getLead(), null);
122 }

References Vendor\Package\$c, Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ test_with_properties()

ItemTest::test_with_properties ( )

Definition at line 49 of file ItemTest.php.

50 {
51 $f = $this->getFactory();
52
53 $props = array("prop1" => "val1", "prop2" => "val2");
54 $c = $f->standard("title")->withProperties($props);
55
56 $this->assertEquals($c->getProperties(), $props);
57 }

References Vendor\Package\$c, Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

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