ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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_text ()
 
 test_with_no_lead ()
 
 test_render_base ()
 
 test_render_lead_image ()
 
 test_render_lead_text_and_color ()
 
 test_shy_title_and_property ()
 
- 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 items.

Definition at line 13 of file ItemTest.php.

Member Function Documentation

◆ getFactory()

ItemTest::getFactory ( )
Returns
\ILIAS\UI\Implementation\Factory

Definition at line 19 of file ItemTest.php.

20 {
21 return new \ILIAS\UI\Implementation\Factory();
22 }

Referenced by test_get_title(), test_implements_factory_interface(), test_render_base(), test_render_lead_image(), test_render_lead_text_and_color(), test_shy_title_and_property(), test_with_actions(), test_with_color(), test_with_description(), test_with_lead_image(), test_with_lead_text(), test_with_no_lead(), and test_with_properties().

+ Here is the caller graph for this function:

◆ test_get_title()

ItemTest::test_get_title ( )

Definition at line 31 of file ItemTest.php.

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

References getFactory().

+ Here is the call graph for this function:

◆ test_implements_factory_interface()

ItemTest::test_implements_factory_interface ( )

Definition at line 24 of file ItemTest.php.

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

References getFactory().

+ Here is the call graph for this function:

◆ test_render_base()

ItemTest::test_render_base ( )

Definition at line 112 of file ItemTest.php.

113 {
114 $f = $this->getFactory();
115 $r = $this->getDefaultRenderer();
116
117 $actions = $f->dropdown()->standard(array(
118 $f->button()->shy("ILIAS", "https://www.ilias.de"),
119 $f->button()->shy("GitHub", "https://www.github.com")
120 ));
121 $c = $f->item()->standard("Item Title")
122 ->withActions($actions)
123 ->withProperties(array(
124 "Origin" => "Course Title 1",
125 "Last Update" => "24.11.2011",
126 "Location" => "Room 123, Main Street 44, 3012 Bern"))
127 ->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.");
128
129 $html = $r->render($c);
130 $expected = <<<EOT
131 <div class="il-item il-std-item ">
132 <h5>Item Title</h5>
133 <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>
134<ul class="dropdown-menu">
135 <li><a class="btn btn-link" href="https://www.ilias.de" data-action="https://www.ilias.de" >ILIAS</a></li>
136 <li><a class="btn btn-link" href="https://www.github.com" data-action="https://www.github.com" >GitHub</a></li>
137</ul>
138</div>
139 <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>
140 <hr class="il-item-divider" />
141 <div class="row">
142 <div class="col-md-6">
143 <div class="row">
144 <div class="col-sm-5 il-item-property-name">Origin</div>
145 <div class="col-sm-7 il-item-property-value il-multi-line-cap-3">Course Title 1</div>
146 </div>
147 </div>
148 <div class="col-md-6">
149 <div class="row">
150 <div class="col-sm-5 il-item-property-name">Last Update</div>
151 <div class="col-sm-7 il-item-property-value il-multi-line-cap-3">24.11.2011</div>
152 </div>
153 </div>
154 </div>
155 <div class="row">
156 <div class="col-md-6">
157 <div class="row">
158 <div class="col-sm-5 il-item-property-name">Location</div>
159 <div class="col-sm-7 il-item-property-value il-multi-line-cap-3">Room 123, Main Street 44, 3012 Bern</div>
160 </div>
161 </div>
162 <div class="col-md-6">
163 <div class="row">
164 <div class="col-sm-5 il-item-property-name"></div>
165 <div class="col-sm-7 il-item-property-value il-multi-line-cap-3"></div>
166 </div>
167 </div>
168 </div>
169</div>
170EOT;
171
172 $this->assertHTMLEquals($expected, $html);
173 }
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:252
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
Title class.
Definition: Title.php:37
$html
Definition: example_001.php:87
$r
Definition: example_031.php:79
Class BaseForm.
$this data['403_header']

References $html, $r, ILIAS_UI_TestBase\assertHTMLEquals(), data, 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 175 of file ItemTest.php.

176 {
177 $f = $this->getFactory();
178 $r = $this->getDefaultRenderer();
179
180 $image = $f->image()->standard("src", "str");
181
182 $c = $f->item()->standard("title")->withLeadImage($image);
183
184 $html = $r->render($c);
185
186 $expected = <<<EOT
187<div class="il-item il-std-item ">
188 <div class="row">
189 <div class="col-sm-3">
190 <img src="src" class="img-standard" alt="str" />
191 </div>
192 <div class="col-sm-9">
193 <h5>title</h5>
194 </div>
195 </div>
196</div>
197EOT;
198
199 $this->assertHTMLEquals($expected, $html);
200 }

References $html, $r, ILIAS_UI_TestBase\assertHTMLEquals(), 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 202 of file ItemTest.php.

203 {
204 $f = $this->getFactory();
205 $r = $this->getDefaultRenderer();
206 $df = new \ILIAS\Data\Factory();
207
208 $color = $df->color('#ff00ff');
209
210 $c = $f->item()->standard("title")->withColor($color)->withLeadText("lead");
211
212 $html = $r->render($c);
213
214 $expected = <<<EOT
215<div class="il-item il-std-item il-item-marker " style="border-color:#ff00ff">
216 <div class="row">
217 <div class="col-sm-3">
218 <h5>lead</h5>
219 </div>
220 <div class="col-sm-9">
221 <h5>title</h5>
222 </div>
223 </div>
224</div>
225EOT;
226
227 $this->assertHTMLEquals($expected, $html);
228 }

References $html, $r, ILIAS_UI_TestBase\assertHTMLEquals(), 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 230 of file ItemTest.php.

231 {
232 $f = $this->getFactory();
233 $r = $this->getDefaultRenderer();
234 $df = new \ILIAS\Data\Factory();
235
236 $color = $df->color('#ff00ff');
237
238 $c = $f->item()->standard($f->button()->shy("ILIAS", "https://www.ilias.de"))
239 ->withProperties(array("test" => $f->button()->shy("GitHub", "https://www.github.com")));
240
241 $html = $r->render($c);
242 $expected = <<<EOT
243<div class="il-item il-std-item ">
244 <h5><a class="btn btn-link" href="https://www.ilias.de" data-action="https://www.ilias.de" >ILIAS</a></h5>
245 <hr class="il-item-divider" />
246 <div class="row">
247 <div class="col-md-6">
248 <div class="row">
249 <div class="col-sm-5 il-item-property-name">test</div>
250 <div class="col-sm-7 il-item-property-value il-multi-line-cap-3"><a class="btn btn-link" href="https://www.github.com" data-action="https://www.github.com" >GitHub</a></div>
251 </div>
252 </div>
253 <div class="col-md-6">
254 <div class="row">
255 <div class="col-sm-5 il-item-property-name"></div>
256 <div class="col-sm-7 il-item-property-value il-multi-line-cap-3"></div>
257 </div>
258 </div>
259 </div>
260</div>
261EOT;
262
263 $this->assertHTMLEquals($expected, $html);
264 }

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

+ Here is the call graph for this function:

◆ test_with_actions()

ItemTest::test_with_actions ( )

Definition at line 58 of file ItemTest.php.

59 {
60 $f = $this->getFactory();
61
62 $actions = $f->dropdown()->standard(array(
63 $f->button()->shy("ILIAS", "https://www.ilias.de"),
64 $f->button()->shy("GitHub", "https://www.github.com")
65 ));
66 $c = $f->item()->standard("title")->withActions($actions);
67
68 $this->assertEquals($c->getActions(), $actions);
69 }

References getFactory().

+ Here is the call graph for this function:

◆ test_with_color()

ItemTest::test_with_color ( )

Definition at line 71 of file ItemTest.php.

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

References getFactory().

+ Here is the call graph for this function:

◆ test_with_description()

ItemTest::test_with_description ( )

Definition at line 39 of file ItemTest.php.

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

References getFactory().

+ Here is the call graph for this function:

◆ test_with_lead_image()

ItemTest::test_with_lead_image ( )

Definition at line 83 of file ItemTest.php.

84 {
85 $f = $this->getFactory();
86
87 $image = $f->image()->standard("src", "str");
88
89 $c = $f->item()->standard("title")->withLeadImage($image);
90
91 $this->assertEquals($c->getLead(), $image);
92 }

References getFactory().

+ Here is the call graph for this function:

◆ test_with_lead_text()

ItemTest::test_with_lead_text ( )

Definition at line 94 of file ItemTest.php.

95 {
96 $f = $this->getFactory();
97
98 $c = $f->item()->standard("title")->withLeadText("text");
99
100 $this->assertEquals($c->getLead(), "text");
101 }

References getFactory().

+ Here is the call graph for this function:

◆ test_with_no_lead()

ItemTest::test_with_no_lead ( )

Definition at line 103 of file ItemTest.php.

104 {
105 $f = $this->getFactory();
106
107 $c = $f->item()->standard("title")->withLeadText("text")->withNoLead();
108
109 $this->assertEquals($c->getLead(), null);
110 }

References getFactory().

+ Here is the call graph for this function:

◆ test_with_properties()

ItemTest::test_with_properties ( )

Definition at line 48 of file ItemTest.php.

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

References getFactory().

+ Here is the call graph for this function:

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