5require_once(__DIR__ .
"/../../../../../libs/composer/vendor/autoload.php");
6require_once(__DIR__ .
"/../../../Base.php");
7require_once(__DIR__ .
"/InputTest.php");
11use \ILIAS\UI\Component\Input\Field;
20 $this->refinery =
new Refinery($this->createMock(Data\Factory::class), $this->createMock(\ilLanguage::class));
27 $language = $this->createMock(\ilLanguage::class);
41 $checkbox =
$f->checkbox(
"label",
"byline");
43 $this->assertInstanceOf(Field\Input::class, $checkbox);
44 $this->assertInstanceOf(Field\Checkbox::class, $checkbox);
53 $checkbox =
$f->checkbox($label, $byline)->withNameFrom($this->name_source);
59 <div class="form-group row">
60 <label for="id_1" class="control-label col-sm-3">label</label>
61 <div class="col-sm-9">
62 <input type="checkbox" id="id_1" value="checked" name="name_0" class="form-control form-control-sm"/>
63 <div class="help-block">byline</div>
77 $checkbox =
$f->checkbox($label, $byline)->withNameFrom($this->name_source)->withError($error);
82 <div class="form-group row">
83 <label for="id_1" class="control-label col-sm-3">label</label>
84 <div class="col-sm-9">
85 <div class="help-block alert alert-danger" role="alert">an_error</div>
86 <input type="checkbox" id="id_1" value="checked" name="name_0" class="form-control form-control-sm"/>
87 <div class="help-block">byline</div>
100 $checkbox =
$f->checkbox($label)->withNameFrom($this->name_source);
106 <div class="form-group row">
107 <label for="id_1" class="control-label col-sm-3">label</label>
108 <div class="col-sm-9">
109 <input type="checkbox" id="id_1" value="checked" name="name_0" class="form-control form-control-sm" />
122 $checkbox =
$f->checkbox($label)->withValue($value)->withNameFrom($this->name_source);
127 <div class="form-group row">
128 <label for="id_1" class="control-label col-sm-3">label</label>
129 <div class="col-sm-9">
130 <input type="checkbox" id="id_1" value="checked" checked="checked" name="name_0" class="form-control form-control-sm" />
143 $f->checkbox($label)->withValue($value);
144 $this->assertFalse(
true);
145 }
catch (InvalidArgumentException
$e) {
146 $this->assertTrue(
true);
155 $checkbox =
$f->checkbox($label)->withNameFrom($this->name_source)->withRequired(
true);
161 <div class="form-group row">
162 <label for="id_1" class="control-label col-sm-3">label<span class="asterisk">*</span></label>
163 <div class="col-sm-9"><input type="checkbox" id="id_1" value="checked" name="name_0" class="form-control form-control-sm"/></div>
174 $checkbox =
$f->checkbox($label)->withNameFrom($this->name_source)->withDisabled(
true);
180 <div class="form-group row">
181 <label for="id_1" class="control-label col-sm-3">label</label>
182 <div class="col-sm-9"><input type="checkbox" id="id_1" value="checked" name="name_0" disabled="disabled" class="form-control form-control-sm"/></div>
193 $checkbox =
$f->checkbox($label)->withNameFrom($this->name_source);
195 $input_data = $this->createMock(InputData::class);
197 ->expects($this->atLeastOnce())
200 ->willReturn(
"checked");
202 $checkbox_true = $checkbox->withInput($input_data);
204 $this->assertIsBool($checkbox_true->getContent()->value());
205 $this->assertTrue($checkbox_true->getContent()->value());
212 $checkbox =
$f->checkbox($label)->withNameFrom($this->name_source);
214 $input_data = $this->createMock(InputData::class);
216 ->expects($this->atLeastOnce())
221 $checkbox_false = $checkbox->withInput($input_data);
223 $this->assertIsBool($checkbox_false->getContent()->value());
224 $this->assertFalse($checkbox_false->getContent()->value());
231 $checkbox =
$f->checkbox($label)
232 ->withNameFrom($this->name_source)
235 ->withInput($this->createMock(InputData::class))
238 $this->assertIsBool($checkbox->getContent()->value());
239 $this->assertTrue($checkbox->getContent()->value());
247 $new_value =
"NEW_VALUE";
248 $checkbox =
$f->checkbox($label)
249 ->withNameFrom($this->name_source)
252 ->withAdditionalTransformation($this->refinery->custom()->transformation(function ($v) use (&$called, $new_value) {
256 ->withInput($this->createMock(InputData::class))
259 $this->assertIsString($checkbox->getContent()->value());
260 $this->assertEquals($new_value, $checkbox->getContent()->value());
266 $checkbox =
$f->checkbox(
"label");
267 $checkbox->withValue(
null);
268 $this->assertEquals(
false, $checkbox->getValue());
An exception for terminatinating execution or to throw for unit testing.
Provides common functionality for UI tests.
assertHTMLEquals($expected_html_as_string, $html_as_string)
getDefaultRenderer(JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
brutallyTrimHTML($html)
A more radical version of normalizeHTML.
Class ChatMainBarProvider \MainMenu\Provider.