ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
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\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  }
Interface Observer Contains several chained tasks and infos about them.
Builds data types.
Definition: Factory.php:35

◆ 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  }

◆ 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  }

◆ 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  }
Builds data types.
Definition: Factory.php:35

◆ getUIFactory()

FilterInputTest::getUIFactory ( )

Definition at line 111 of file FilterInputTest.php.

◆ testRenderDateTimeWithDurationAndFilterContext()

FilterInputTest::testRenderDateTimeWithDurationAndFilterContext ( )

Definition at line 254 of file FilterInputTest.php.

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

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

◆ testRenderDateTimeWithFilterContext()

FilterInputTest::testRenderDateTimeWithFilterContext ( )

Definition at line 227 of file FilterInputTest.php.

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

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

◆ testRenderDurationWithFilterContext()

FilterInputTest::testRenderDurationWithFilterContext ( )

Definition at line 278 of file FilterInputTest.php.

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

278  : void
279  {
280  $f = $this->buildFactory();
281  $if = $this->buildInputFactory();
282  $datetime = $if->duration('label', 'byline'); // byline will not be rendered in this context
283  $filter = $f->standard("#", "#", "#", "#", "#", "#", [], [], false, false);
284  $fr = $this->getDefaultRenderer(null, [], [$filter]);
285  $html = $this->brutallyTrimHTML($fr->render($datetime));
286  $label_start = 'duration_default_label_start';
287  $label_end = 'duration_default_label_end';
288 
289 
290  $expected = $this->brutallyTrimHTML('
291  <div class="col-md-6 col-lg-4 il-popover-container">
292  <div 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_7" data-placement="bottom"></span>
295  <div class="il-standard-popover-content" style="display:none;" id="id_5"></div>
296  <span class="input-group-addon rightaddon">
297  <a class="glyph" href="" aria-label="remove" id="id_8">
298  <span class="glyphicon glyphicon-minus-sign" aria-hidden="true"></span>
299  </a>
300  </span>
301  </div>
302  {POPOVER}
303  </div>
304  ');
305  $this->assertHTMLEquals($expected, $html);
306  }
$datetime
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ testRenderMultiSelectWithFilterContext()

FilterInputTest::testRenderMultiSelectWithFilterContext ( )

Definition at line 199 of file FilterInputTest.php.

References Vendor\Package\$f, and null.

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

◆ testRenderNumericWithFilterContext()

FilterInputTest::testRenderNumericWithFilterContext ( )

Definition at line 145 of file FilterInputTest.php.

References Vendor\Package\$f, and null.

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">
156  <div class="input-group">
157  <label for="id_1" class="input-group-addon leftaddon">label</label>
158  <input id="id_1" type="number" step="1" class="c-field-number" />
159  <span class="input-group-addon rightaddon">
160  <a class="glyph" href="" aria-label="remove" id="id_2">
161  <span class="glyphicon glyphicon-minus-sign" aria-hidden="true"></span>
162  </a>
163  </span>
164  </div>
165  </div>
166  ');
167  $this->assertHTMLEquals($expected, $html);
168  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ testRenderSelectWithFilterContext()

FilterInputTest::testRenderSelectWithFilterContext ( )

Definition at line 170 of file FilterInputTest.php.

References Vendor\Package\$f, and null.

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

◆ testRenderTextWithFilterContext()

FilterInputTest::testRenderTextWithFilterContext ( )

Definition at line 120 of file FilterInputTest.php.

References Vendor\Package\$f, and null.

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 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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

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