ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
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 ()
 
 buildPopoverFactory ()
 
 buildLegacyFactory ()
 

Detailed Description

Test on rendering filter inputs.

Definition at line 64 of file FilterInputTest.php.

Member Function Documentation

◆ buildFactory()

FilterInputTest::buildFactory ( )
protected

Definition at line 66 of file FilterInputTest.php.

66 : I\Input\Container\Filter\Factory
67 {
68 return new I\Input\Container\Filter\Factory(
69 new I\SignalGenerator(),
70 $this->buildInputFactory()
71 );
72 }

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 74 of file FilterInputTest.php.

74 : I\Input\Field\Factory
75 {
76 $df = new Data\Factory();
77 $language = $this->createMock(ILIAS\Language\Language::class);
78 return new I\Input\Field\Factory(
79 $this->createMock(\ILIAS\UI\Implementation\Component\Input\Field\Node\Factory::class),
80 $this->createMock(\ILIAS\UI\Implementation\Component\Input\UploadLimitResolver::class),
81 new I\SignalGenerator(),
82 $df,
83 new ILIAS\Refinery\Factory($df, $language),
84 $language
85 );
86 }
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 102 of file FilterInputTest.php.

102 : I\Legacy\Factory
103 {
104 $mock = $this->createMock(I\Legacy\Factory::class);
105 $mock->method('content')->willReturn(
106 new I\Legacy\Content('', new I\SignalGenerator())
107 );
108 return $mock;
109 }

Referenced by getUIFactory().

+ Here is the caller graph for this function:

◆ buildPopoverFactory()

FilterInputTest::buildPopoverFactory ( )
protected

Definition at line 97 of file FilterInputTest.php.

97 : I\Popover\Factory
98 {
99 return new I\Popover\Factory(new I\SignalGenerator());
100 }

Referenced by getUIFactory().

+ Here is the caller graph for this function:

◆ buildSymbolFactory()

FilterInputTest::buildSymbolFactory ( )
protected

Definition at line 88 of file FilterInputTest.php.

88 : I\Symbol\Factory
89 {
90 return new I\Symbol\Factory(
91 new I\Symbol\Icon\Factory(),
92 new I\Symbol\Glyph\Factory(),
93 new I\Symbol\Avatar\Factory()
94 );
95 }

Referenced by getUIFactory().

+ Here is the caller graph for this function:

◆ getUIFactory()

FilterInputTest::getUIFactory ( )

Definition at line 111 of file FilterInputTest.php.

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

+ Here is the call graph for this function:

◆ testRenderDateTimeWithDurationAndFilterContext()

FilterInputTest::testRenderDateTimeWithDurationAndFilterContext ( )

Definition at line 249 of file FilterInputTest.php.

249 : void
250 {
251 $f = $this->buildFactory();
252 $if = $this->buildInputFactory();
253 $duration = $if->duration('label', 'byline');
254 $datetime = $if->dateTime('label', 'byline'); // byline will not be rendered in this context
255 $filter = $f->standard("#", "#", "#", "#", "#", "#", [], [], false, false);
256 $dr = $this->getDefaultRenderer(null, [], [$filter, $duration, $datetime]);
257 $html = $this->brutallyTrimHTML($dr->render($datetime));
258
259 $expected = $this->brutallyTrimHTML('
260 <fieldset class="c-input" data-il-ui-component="" data-il-ui-input-name="">
261 <label for="id_1">label</label>
262 <div class="c-input__field">
263 <div class="c-input-group">
264 <input id="id_1" type="date" class="c-field-datetime" />
265 </div>
266 </div>
267 </fieldset>
268 ');
269 $this->assertEquals($expected, $html);
270 $this->assertHTMLEquals($expected, $html);
271 }
$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 223 of file FilterInputTest.php.

223 : void
224 {
225 $f = $this->buildFactory();
226 $if = $this->buildInputFactory();
227 $datetime = $if->dateTime('label', 'byline'); // byline will not be rendered in this context
228 $filter = $f->standard("#", "#", "#", "#", "#", "#", [], [], false, false);
229 $fr = $this->getDefaultRenderer(null, [], [$filter]);
230 $html = $this->brutallyTrimHTML($fr->render($datetime));
231
232 $expected = $this->brutallyTrimHTML('
233 <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">
234 <label for="id_1" class="input-group-addon leftaddon">label</label>
235 <div class="c-input-group">
236 <input id="id_1" type="date" class="c-field-datetime" />
237 </div>
238 <span class="input-group-addon rightaddon">
239 <a class="glyph" href="" aria-label="remove" id="id_2">
240 <span class="glyphicon glyphicon-minus-sign" aria-hidden="true"></span>
241 </a>
242 </span>
243 </div>
244 </div>
245 ');
246 $this->assertHTMLEquals($expected, $html);
247 }

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

+ Here is the call graph for this function:

◆ testRenderDurationWithFilterContext()

FilterInputTest::testRenderDurationWithFilterContext ( )

Definition at line 273 of file FilterInputTest.php.

273 : void
274 {
275 $f = $this->buildFactory();
276 $if = $this->buildInputFactory();
277 $datetime = $if->duration('label', 'byline'); // byline will not be rendered in this context
278 $filter = $f->standard("#", "#", "#", "#", "#", "#", [], [], false, false);
279 $fr = $this->getDefaultRenderer(null, [], [$filter]);
280 $html = $this->brutallyTrimHTML($fr->render($datetime));
281 $label_start = 'duration_default_label_start';
282 $label_end = 'duration_default_label_end';
283
284
285 $expected = $this->brutallyTrimHTML('
286 <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">
287 <label class="input-group-addon leftaddon">label</label>
288 <span role="button" tabindex="0" class="form-control il-filter-field" id="id_6" data-placement="bottom"></span>
289 <div class="il-standard-popover-content" style="display:none;" id="id_4"></div>
290 <span class="input-group-addon rightaddon">
291 <a class="glyph" href="" aria-label="remove" id="id_7">
292 <span class="glyphicon glyphicon-minus-sign" aria-hidden="true"></span>
293 </a>
294 </span>
295 </div>
296 </div>
297 ');
298 $this->assertHTMLEquals($expected, $html);
299 }

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

+ Here is the call graph for this function:

◆ testRenderMultiSelectWithHasOptionFilter()

FilterInputTest::testRenderMultiSelectWithHasOptionFilter ( )

Definition at line 197 of file FilterInputTest.php.

197 : void
198 {
199 $f = $this->buildFactory();
200 $if = $this->buildInputFactory();
201 $options = ["one" => "One", "two" => "Two", "three" => "Three"];
202 $multi = $if->multiSelect('label', $options, 'byline'); // byline will not be rendered in this context
203 $filter = $f->standard("#", "#", "#", "#", "#", "#", [], [], false, false);
204 $fr = $this->getDefaultRenderer(null, [], [$filter]);
205 $html = $this->brutallyTrimHTML($fr->render($multi));
206
207 $expected = $this->brutallyTrimHTML('
208 <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">
209 <label class="input-group-addon leftaddon">label</label>
210 <span role="button" tabindex="0" class="form-control il-filter-field" id="id_3" data-placement="bottom"></span>
211 <div class="il-standard-popover-content" style="display:none;" id="id_1"></div>
212 <span class="input-group-addon rightaddon">
213 <span class="glyph" aria-label="remove" role="img" id="id_4">
214 <span class="glyphicon glyphicon-minus-sign" aria-hidden="true"></span>
215 </span>
216 </span>
217 </div>
218 </div>
219 ');
220 $this->assertHTMLEquals($expected, $html);
221 }

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 145 of file FilterInputTest.php.

145 : void
146 {
147 $f = $this->buildFactory();
148 $if = $this->buildInputFactory();
149 $numeric = $if->numeric('label', 'byline'); // byline will not be rendered in this context
150 $filter = $f->standard("#", "#", "#", "#", "#", "#", [], [], false, false);
151 $fr = $this->getDefaultRenderer(null, [], [$filter]);
152 $html = $this->brutallyTrimHTML($fr->render($numeric));
153
154 $expected = $this->brutallyTrimHTML('
155 <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">
156 <label for="id_1" class="input-group-addon leftaddon">label</label>
157 <input id="id_1" type="number" step="1" class="c-field-number" />
158 <span class="input-group-addon rightaddon">
159 <a class="glyph" href="" aria-label="remove" id="id_2">
160 <span class="glyphicon glyphicon-minus-sign" aria-hidden="true"></span>
161 </a>
162 </span>
163 </div>
164 </div>
165 ');
166 $this->assertHTMLEquals($expected, $html);
167 }

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

+ Here is the call graph for this function:

◆ testRenderSelectWithFilterContext()

FilterInputTest::testRenderSelectWithFilterContext ( )

Definition at line 169 of file FilterInputTest.php.

169 : void
170 {
171 $f = $this->buildFactory();
172 $if = $this->buildInputFactory();
173 $options = ["one" => "One", "two" => "Two", "three" => "Three"];
174 $select = $if->select('label', $options, 'byline'); // byline will not be rendered in this context
175 $filter = $f->standard("#", "#", "#", "#", "#", "#", [], [], false, false);
176 $fr = $this->getDefaultRenderer(null, [], [$filter]);
177 $html = $this->brutallyTrimHTML($fr->render($select));
178
179 $expected = $this->brutallyTrimHTML('
180 <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">
181 <label for="id_1" class="input-group-addon leftaddon">label</label>
182 <select id="id_1">
183 <option selected="selected" value="">-</option>
184 <option value="one">One</option>
185 <option value="two">Two</option>
186 <option value="three">Three</option>
187 </select>
188 <span class="input-group-addon rightaddon">
189 <a class="glyph" href="" aria-label="remove" id="id_2"><span class="glyphicon glyphicon-minus-sign" aria-hidden="true"></span></a>
190 </span>
191 </div>
192 </div>
193 ');
194 $this->assertHTMLEquals($expected, $html);
195 }

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 120 of file FilterInputTest.php.

120 : void
121 {
122 $f = $this->buildFactory();
123 $if = $this->buildInputFactory();
124 $text = $if->text('label', 'byline'); // byline will not be rendered in this context
125 $filter = $f->standard("#", "#", "#", "#", "#", "#", [], [], false, false);
126 $fr = $this->getDefaultRenderer(null, [], [$filter]);
127 $html = $this->brutallyTrimHTML($fr->render($text));
128
129 $expected = $this->brutallyTrimHTML('
130 <div class="col-md-6 col-lg-4 il-popover-container">
131 <div data-il-ui-component="text-field-input" data-il-ui-input-name="" class="input-group">
132 <label for="id_1" class="input-group-addon leftaddon">label</label>
133 <input id="id_1" type="text" class="c-field-text" />
134 <span class="input-group-addon rightaddon">
135 <a class="glyph" href="" aria-label="remove" id="id_2">
136 <span class="glyphicon glyphicon-minus-sign" aria-hidden="true"></span>
137 </a>
138 </span>
139 </div>
140 </div>
141 ');
142 $this->assertHTMLEquals($expected, $html);
143 }
$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: