ILIAS  trunk Revision v12.0_alpha-1329-g1094ddb0c33
FilterInputTest Class Reference

Test on rendering filter inputs. More...

+ Inheritance diagram for FilterInputTest:
+ Collaboration diagram for FilterInputTest:

Public Member Functions

 getUIFactory ()
 
 testRenderTextWithFilterContext ()
 
 testRenderNumericWithFilterContext ()
 
 testRenderSelectWithFilterContext ()
 
 testRenderMultiSelectWithHasOptionFilter ()
 
 testRenderDateTimeWithFilterContext ()
 
 testRenderDateTimeWithDurationAndFilterContext ()
 
 testRenderDurationWithFilterContext ()
 

Protected Member Functions

 buildFactory ()
 
 buildInputFactory ()
 
 buildSymbolFactory ()
 
 buildButtonFactory ()
 
 buildPopoverFactory ()
 
 buildLegacyFactory ()
 

Detailed Description

Test on rendering filter inputs.

Definition at line 72 of file FilterInputTest.php.

Member Function Documentation

◆ buildButtonFactory()

FilterInputTest::buildButtonFactory ( )
protected

Definition at line 105 of file FilterInputTest.php.

105 : I\Button\Factory
106 {
107 return new I\Button\Factory();
108 }

Referenced by getUIFactory().

+ Here is the caller graph for this function:

◆ buildFactory()

FilterInputTest::buildFactory ( )
protected

Definition at line 74 of file FilterInputTest.php.

74 : I\Input\Container\Filter\Factory
75 {
76 return new I\Input\Container\Filter\Factory(
77 new I\SignalGenerator(),
78 $this->buildInputFactory()
79 );
80 }

References buildInputFactory().

Referenced by testRenderDateTimeWithDurationAndFilterContext(), testRenderDateTimeWithFilterContext(), testRenderDurationWithFilterContext(), testRenderMultiSelectWithHasOptionFilter(), testRenderNumericWithFilterContext(), testRenderSelectWithFilterContext(), and testRenderTextWithFilterContext().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildInputFactory()

FilterInputTest::buildInputFactory ( )
protected

Definition at line 82 of file FilterInputTest.php.

82 : I\Input\Field\Factory
83 {
84 $df = new Data\Factory();
85 $language = $this->createMock(ILIAS\Language\Language::class);
86 return new I\Input\Field\Factory(
87 $this->createMock(\ILIAS\UI\Implementation\Component\Input\Field\Node\Factory::class),
88 $this->createMock(\ILIAS\UI\Implementation\Component\Input\UploadLimitResolver::class),
89 new I\SignalGenerator(),
90 $df,
91 new ILIAS\Refinery\Factory($df, $language),
92 $language
93 );
94 }
Builds data types.
Definition: Factory.php:36
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

Referenced by buildFactory(), testRenderDateTimeWithDurationAndFilterContext(), testRenderDateTimeWithFilterContext(), testRenderDurationWithFilterContext(), testRenderMultiSelectWithHasOptionFilter(), testRenderNumericWithFilterContext(), testRenderSelectWithFilterContext(), and testRenderTextWithFilterContext().

+ Here is the caller graph for this function:

◆ buildLegacyFactory()

FilterInputTest::buildLegacyFactory ( )
protected

Definition at line 115 of file FilterInputTest.php.

115 : I\Legacy\Factory
116 {
117 $mock = $this->createMock(I\Legacy\Factory::class);
118 $mock->method('content')->willReturn(
119 new I\Legacy\Content('', new I\SignalGenerator())
120 );
121 return $mock;
122 }

Referenced by getUIFactory().

+ Here is the caller graph for this function:

◆ buildPopoverFactory()

FilterInputTest::buildPopoverFactory ( )
protected

Definition at line 110 of file FilterInputTest.php.

110 : I\Popover\Factory
111 {
112 return new I\Popover\Factory(new I\SignalGenerator());
113 }

Referenced by getUIFactory().

+ Here is the caller graph for this function:

◆ buildSymbolFactory()

FilterInputTest::buildSymbolFactory ( )
protected

Definition at line 96 of file FilterInputTest.php.

96 : I\Symbol\Factory
97 {
98 return new I\Symbol\Factory(
99 new I\Symbol\Icon\Factory(),
100 new I\Symbol\Glyph\Factory(),
101 new I\Symbol\Avatar\Factory()
102 );
103 }

Referenced by getUIFactory().

+ Here is the caller graph for this function:

◆ getUIFactory()

FilterInputTest::getUIFactory ( )

Definition at line 124 of file FilterInputTest.php.

References buildButtonFactory(), buildLegacyFactory(), buildPopoverFactory(), and buildSymbolFactory().

+ Here is the call graph for this function:

◆ testRenderDateTimeWithDurationAndFilterContext()

FilterInputTest::testRenderDateTimeWithDurationAndFilterContext ( )

Definition at line 255 of file FilterInputTest.php.

255 : void
256 {
257 $f = $this->buildFactory();
258 $if = $this->buildInputFactory();
259 $duration = $if->duration('label', 'byline');
260 $datetime = $if->dateTime('label', 'byline'); // byline will not be rendered in this context
261 $filter = $f->standard("#", "#", "#", "#", "#", "#", [], [], false, false);
262 $dr = $this->getDefaultRenderer(null, [], [$filter, $duration, $datetime]);
263 $html = $this->brutallyTrimHTML($dr->render($datetime));
264
265 $expected = $this->brutallyTrimHTML('
266 <fieldset class="c-input" data-il-ui-component="" data-il-ui-input-name="">
267 <label for="id_1">label</label>
268 <div class="c-input__field">
269 <div class="c-input-group">
270 <input id="id_1" type="date" class="c-field-datetime" />
271 </div>
272 </div>
273 </fieldset>
274 ');
275 $this->assertEquals($expected, $html);
276 $this->assertHTMLEquals($expected, $html);
277 }
$datetime
$duration

References $datetime, $duration, Vendor\Package\$f, buildFactory(), and buildInputFactory().

+ Here is the call graph for this function:

◆ testRenderDateTimeWithFilterContext()

FilterInputTest::testRenderDateTimeWithFilterContext ( )

Definition at line 231 of file FilterInputTest.php.

231 : void
232 {
233 $f = $this->buildFactory();
234 $if = $this->buildInputFactory();
235 $datetime = $if->dateTime('label', 'byline'); // byline will not be rendered in this context
236 $filter = $f->standard("#", "#", "#", "#", "#", "#", [], [], false, false);
237 $fr = $this->getDefaultRenderer(null, [], [$filter]);
238 $html = $this->brutallyTrimHTML($fr->render($datetime));
239
240 $expected = $this->brutallyTrimHTML('
241 <div class="col-md-6 col-lg-4 il-popover-container"><div data-il-ui-component="date-time-field-input" data-il-ui-input-name="" class="input-group">
242 <label for="id_1" class="input-group-addon leftaddon">label</label>
243 <div class="c-input-group">
244 <input id="id_1" type="date" class="c-field-datetime" />
245 </div>
246 <span class="input-group-addon rightaddon">
247 <button type="button" class="btn btn-link" aria-label="remove" data-action="" id="id_2"><span class="glyph" aria-hidden="true"><span class="glyphicon glyphicon-minus-sign" aria-hidden="true"></span></span></button>
248 </span>
249 </div>
250 </div>
251 ');
252 $this->assertHTMLEquals($expected, $html);
253 }

References $datetime, Vendor\Package\$f, buildFactory(), and buildInputFactory().

+ Here is the call graph for this function:

◆ testRenderDurationWithFilterContext()

FilterInputTest::testRenderDurationWithFilterContext ( )

Definition at line 279 of file FilterInputTest.php.

279 : void
280 {
281 $f = $this->buildFactory();
282 $if = $this->buildInputFactory();
283 $datetime = $if->duration('label', 'byline'); // byline will not be rendered in this context
284 $filter = $f->standard("#", "#", "#", "#", "#", "#", [], [], false, false);
285 $fr = $this->getDefaultRenderer(null, [], [$filter]);
286 $html = $this->brutallyTrimHTML($fr->render($datetime));
287 $label_start = 'duration_default_label_start';
288 $label_end = 'duration_default_label_end';
289
290
291 $expected = $this->brutallyTrimHTML('
292 <div class="col-md-6 col-lg-4 il-popover-container"><div data-il-ui-component="duration-field-input" data-il-ui-input-name="" class="input-group">
293 <label class="input-group-addon leftaddon">label</label>
294 <span role="button" tabindex="0" class="form-control il-filter-field" id="id_6" data-placement="bottom"></span>
295 <div class="il-standard-popover-content" style="display:none;" id="id_4"></div>
296 <span class="input-group-addon rightaddon">
297 <button type="button" class="btn btn-link" aria-label="remove" data-action="" id="id_7"><span class="glyph" aria-hidden="true"><span class="glyphicon glyphicon-minus-sign" aria-hidden="true"></span></span></button>
298 </span>
299 </div>
300 </div>
301 ');
302 $this->assertHTMLEquals($expected, $html);
303 }

References $datetime, Vendor\Package\$f, buildFactory(), and buildInputFactory().

+ Here is the call graph for this function:

◆ testRenderMultiSelectWithHasOptionFilter()

FilterInputTest::testRenderMultiSelectWithHasOptionFilter ( )

Definition at line 207 of file FilterInputTest.php.

207 : void
208 {
209 $f = $this->buildFactory();
210 $if = $this->buildInputFactory();
211 $options = ["one" => "One", "two" => "Two", "three" => "Three"];
212 $multi = $if->multiSelect('label', $options, 'byline'); // byline will not be rendered in this context
213 $filter = $f->standard("#", "#", "#", "#", "#", "#", [], [], false, false);
214 $fr = $this->getDefaultRenderer(null, [], [$filter]);
215 $html = $this->brutallyTrimHTML($fr->render($multi));
216
217 $expected = $this->brutallyTrimHTML('
218 <div class="col-md-6 col-lg-4 il-popover-container"><div data-il-ui-component="multi-select-field-input" data-il-ui-input-name="" class="input-group">
219 <label class="input-group-addon leftaddon">label</label>
220 <span role="button" tabindex="0" class="form-control il-filter-field" id="id_3" data-placement="bottom"></span>
221 <div class="il-standard-popover-content" style="display:none;" id="id_1"></div>
222 <span class="input-group-addon rightaddon">
223 <button type="button" class="btn btn-link" aria-label="remove" data-action="" id="id_4"><span class="glyph" aria-hidden="true"><span class="glyphicon glyphicon-minus-sign" aria-hidden="true"></span></span></button>
224 </span>
225 </div>
226 </div>
227 ');
228 $this->assertHTMLEquals($expected, $html);
229 }

References Vendor\Package\$f, ILIAS\UI\Implementation\Component\Input\Field\$options, buildFactory(), and buildInputFactory().

+ Here is the call graph for this function:

◆ testRenderNumericWithFilterContext()

FilterInputTest::testRenderNumericWithFilterContext ( )

Definition at line 157 of file FilterInputTest.php.

157 : void
158 {
159 $f = $this->buildFactory();
160 $if = $this->buildInputFactory();
161 $numeric = $if->numeric('label', 'byline'); // byline will not be rendered in this context
162 $filter = $f->standard("#", "#", "#", "#", "#", "#", [], [], false, false);
163 $fr = $this->getDefaultRenderer(null, [], [$filter]);
164 $html = $this->brutallyTrimHTML($fr->render($numeric));
165
166 $expected = $this->brutallyTrimHTML('
167 <div class="col-md-6 col-lg-4 il-popover-container"><div data-il-ui-component="numeric-field-input" data-il-ui-input-name="" class="input-group">
168 <label for="id_1" class="input-group-addon leftaddon">label</label>
169 <input id="id_1" type="number" step="1" class="c-field-number" />
170 <span class="input-group-addon rightaddon">
171 <button type="button" class="btn btn-link" aria-label="remove" data-action="" id="id_2"><span class="glyph" aria-hidden="true"><span class="glyphicon glyphicon-minus-sign" aria-hidden="true"></span></span></button>
172 </span>
173 </div>
174 </div>
175 ');
176 $this->assertHTMLEquals($expected, $html);
177 }

References Vendor\Package\$f, buildFactory(), and buildInputFactory().

+ Here is the call graph for this function:

◆ testRenderSelectWithFilterContext()

FilterInputTest::testRenderSelectWithFilterContext ( )

Definition at line 179 of file FilterInputTest.php.

179 : void
180 {
181 $f = $this->buildFactory();
182 $if = $this->buildInputFactory();
183 $options = ["one" => "One", "two" => "Two", "three" => "Three"];
184 $select = $if->select('label', $options, 'byline'); // byline will not be rendered in this context
185 $filter = $f->standard("#", "#", "#", "#", "#", "#", [], [], false, false);
186 $fr = $this->getDefaultRenderer(null, [], [$filter]);
187 $html = $this->brutallyTrimHTML($fr->render($select));
188
189 $expected = $this->brutallyTrimHTML('
190 <div class="col-md-6 col-lg-4 il-popover-container"><div data-il-ui-component="select-field-input" data-il-ui-input-name="" class="input-group">
191 <label for="id_1" class="input-group-addon leftaddon">label</label>
192 <select id="id_1">
193 <option selected="selected" value="">-</option>
194 <option value="one">One</option>
195 <option value="two">Two</option>
196 <option value="three">Three</option>
197 </select>
198 <span class="input-group-addon rightaddon">
199 <button type="button" class="btn btn-link" aria-label="remove" data-action="" id="id_2"><span class="glyph" aria-hidden="true"><span class="glyphicon glyphicon-minus-sign" aria-hidden="true"></span></span></button>
200 </span>
201 </div>
202 </div>
203 ');
204 $this->assertHTMLEquals($expected, $html);
205 }

References Vendor\Package\$f, ILIAS\UI\Implementation\Component\Input\Field\$options, buildFactory(), and buildInputFactory().

+ Here is the call graph for this function:

◆ testRenderTextWithFilterContext()

FilterInputTest::testRenderTextWithFilterContext ( )

Definition at line 134 of file FilterInputTest.php.

134 : void
135 {
136 $f = $this->buildFactory();
137 $if = $this->buildInputFactory();
138 $text = $if->text('label', 'byline'); // byline will not be rendered in this context
139 $filter = $f->standard("#", "#", "#", "#", "#", "#", [], [], false, false);
140 $fr = $this->getDefaultRenderer(null, [], [$filter]);
141 $html = $this->brutallyTrimHTML($fr->render($text));
142
143 $expected = $this->brutallyTrimHTML('
144 <div class="col-md-6 col-lg-4 il-popover-container">
145 <div data-il-ui-component="text-field-input" data-il-ui-input-name="" class="input-group">
146 <label for="id_1" class="input-group-addon leftaddon">label</label>
147 <input id="id_1" type="text" class="c-field-text" />
148 <span class="input-group-addon rightaddon">
149 <button type="button" class="btn btn-link" aria-label="remove" data-action="" id="id_2"><span class="glyph" aria-hidden="true"><span class="glyphicon glyphicon-minus-sign" aria-hidden="true"></span></span></button>
150 </span>
151 </div>
152 </div>
153 ');
154 $this->assertHTMLEquals($expected, $html);
155 }
$text
Definition: xapiexit.php:21

References Vendor\Package\$f, $text, buildFactory(), and buildInputFactory().

+ Here is the call graph for this function:

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