ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
FilterInputTest Class Reference

Test on rendering filter inputs. More...

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

Public Member Functions

 getUIFactory ()
 
 testRenderTextWithFilterContext ()
 
 testRenderNumericWithFilterContext ()
 
 testRenderSelectWithFilterContext ()
 
 testRenderMultiSelectWithFilterContext ()
 
 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  }

◆ 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\UploadLimitResolver::class),
80  new I\SignalGenerator(),
81  $df,
82  new ILIAS\Refinery\Factory($df, $language),
83  $language
84  );
85  }
Interface Observer Contains several chained tasks and infos about them.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Builds data types.
Definition: Factory.php:35

◆ buildLegacyFactory()

FilterInputTest::buildLegacyFactory ( )
protected

Definition at line 101 of file FilterInputTest.php.

101  : I\Legacy\Factory
102  {
103  return new I\Legacy\Factory(new I\SignalGenerator());
104  }

◆ buildPopoverFactory()

FilterInputTest::buildPopoverFactory ( )
protected

Definition at line 96 of file FilterInputTest.php.

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

◆ buildSymbolFactory()

FilterInputTest::buildSymbolFactory ( )
protected

Definition at line 87 of file FilterInputTest.php.

87  : I\Symbol\Factory
88  {
89  return new I\Symbol\Factory(
90  new I\Symbol\Icon\Factory(),
91  new I\Symbol\Glyph\Factory(),
92  new I\Symbol\Avatar\Factory()
93  );
94  }
Builds data types.
Definition: Factory.php:35

◆ getUIFactory()

FilterInputTest::getUIFactory ( )

Definition at line 106 of file FilterInputTest.php.

◆ testRenderDateTimeWithDurationAndFilterContext()

FilterInputTest::testRenderDateTimeWithDurationAndFilterContext ( )

Definition at line 249 of file FilterInputTest.php.

References $datetime, $duration, and Vendor\Package\$f.

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

◆ testRenderDateTimeWithFilterContext()

FilterInputTest::testRenderDateTimeWithFilterContext ( )

Definition at line 222 of file FilterInputTest.php.

References $datetime, and Vendor\Package\$f.

222  : void
223  {
224  $f = $this->buildFactory();
225  $if = $this->buildInputFactory();
226  $datetime = $if->dateTime('label', 'byline'); // byline will not be rendered in this context
227  $filter = $f->standard("#", "#", "#", "#", "#", "#", [], [], false, false);
228  $fr = $this->getDefaultRenderer(null, [], [$filter]);
229  $html = $this->brutallyTrimHTML($fr->render($datetime));
230 
231  $expected = $this->brutallyTrimHTML('
232  <div class="col-md-6 col-lg-4 il-popover-container">
233  <div 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  }
$datetime

◆ testRenderDurationWithFilterContext()

FilterInputTest::testRenderDurationWithFilterContext ( )

Definition at line 273 of file FilterInputTest.php.

References $datetime, and Vendor\Package\$f.

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">
287  <div class="input-group">
288  <label class="input-group-addon leftaddon">label</label>
289  <span role="button" tabindex="0" class="form-control il-filter-field" id="id_7" data-placement="bottom"></span>
290  <div class="il-standard-popover-content" style="display:none;" id="id_5"></div>
291  <span class="input-group-addon rightaddon">
292  <a class="glyph" href="" aria-label="remove" id="id_8">
293  <span class="glyphicon glyphicon-minus-sign" aria-hidden="true"></span>
294  </a>
295  </span>
296  </div>
297  {POPOVER}
298  </div>
299  ');
300  $this->assertHTMLEquals($expected, $html);
301  }
$datetime

◆ testRenderMultiSelectWithFilterContext()

FilterInputTest::testRenderMultiSelectWithFilterContext ( )

Definition at line 194 of file FilterInputTest.php.

References Vendor\Package\$f.

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

◆ testRenderNumericWithFilterContext()

FilterInputTest::testRenderNumericWithFilterContext ( )

Definition at line 140 of file FilterInputTest.php.

References Vendor\Package\$f.

140  : void
141  {
142  $f = $this->buildFactory();
143  $if = $this->buildInputFactory();
144  $numeric = $if->numeric('label', 'byline'); // byline will not be rendered in this context
145  $filter = $f->standard("#", "#", "#", "#", "#", "#", [], [], false, false);
146  $fr = $this->getDefaultRenderer(null, [], [$filter]);
147  $html = $this->brutallyTrimHTML($fr->render($numeric));
148 
149  $expected = $this->brutallyTrimHTML('
150  <div class="col-md-6 col-lg-4 il-popover-container">
151  <div class="input-group">
152  <label for="id_1" class="input-group-addon leftaddon">label</label>
153  <input id="id_1" type="number" class="c-field-number" />
154  <span class="input-group-addon rightaddon">
155  <a class="glyph" href="" aria-label="remove" id="id_2">
156  <span class="glyphicon glyphicon-minus-sign" aria-hidden="true"></span>
157  </a>
158  </span>
159  </div>
160  </div>
161  ');
162  $this->assertHTMLEquals($expected, $html);
163  }

◆ testRenderSelectWithFilterContext()

FilterInputTest::testRenderSelectWithFilterContext ( )

Definition at line 165 of file FilterInputTest.php.

References Vendor\Package\$f.

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

◆ testRenderTextWithFilterContext()

FilterInputTest::testRenderTextWithFilterContext ( )

Definition at line 115 of file FilterInputTest.php.

References Vendor\Package\$f, and $text.

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

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