3 declare(strict_types=1);
21 require_once(__DIR__ .
"/../../../../../libs/composer/vendor/autoload.php");
22 require_once(__DIR__ .
"/../../../Base.php");
23 require_once(__DIR__ .
"/InputTest.php");
40 $this->
refinery =
new Refinery($this->createMock(Data\Factory::class), $this->createMock(ilLanguage::class));
45 $df =
new Data\Factory();
46 $language = $this->createMock(ilLanguage::class);
47 return new I\Input\Field\Factory(
60 $checkbox =
$f->checkbox(
"label",
"byline");
63 $this->assertInstanceOf(Field\Checkbox::class, $checkbox);
71 $checkbox =
$f->checkbox($label, $byline)->withNameFrom($this->name_source);
77 <div class="form-group row"> 78 <label for="id_1" class="control-label col-sm-4 col-md-3 col-lg-2">label</label> 79 <div class="col-sm-8 col-md-9 col-lg-10"> 80 <input type="checkbox" id="id_1" value="checked" name="name_0" class="form-control form-control-sm"/> 81 <div class="help-block">byline</div> 94 $checkbox =
$f->checkbox($label, $byline)->withNameFrom($this->name_source)->withError($error);
99 <div class="form-group row"> 100 <label for="id_1" class="control-label col-sm-4 col-md-3 col-lg-2">label</label> 101 <div class="col-sm-8 col-md-9 col-lg-10"> 102 <div class="help-block alert alert-danger" aria-describedby="id_1" role="alert">an_error</div> 103 <input type="checkbox" id="id_1" value="checked" name="name_0" class="form-control form-control-sm"/> 104 <div class="help-block">byline</div> 116 $checkbox =
$f->checkbox($label)->withNameFrom($this->name_source);
122 <div class="form-group row"> 123 <label for="id_1" class="control-label col-sm-4 col-md-3 col-lg-2">label</label> 124 <div class="col-sm-8 col-md-9 col-lg-10"> 125 <input type="checkbox" id="id_1" value="checked" name="name_0" class="form-control form-control-sm" /> 137 $checkbox =
$f->checkbox($label)->withValue($value)->withNameFrom($this->name_source);
142 <div class="form-group row"> 143 <label for="id_1" class="control-label col-sm-4 col-md-3 col-lg-2">label</label> 144 <div class="col-sm-8 col-md-9 col-lg-10"> 145 <input type="checkbox" id="id_1" value="checked" checked="checked" name="name_0" class="form-control form-control-sm" /> 158 $f->checkbox($label)->withValue($value);
161 $this->assertTrue(
true);
169 $checkbox =
$f->checkbox($label)->withNameFrom($this->name_source)->withRequired(
true);
175 <div class="form-group row"> 176 <label for="id_1" class="control-label col-sm-4 col-md-3 col-lg-2">label<span class="asterisk">*</span></label> 177 <div class="col-sm-8 col-md-9 col-lg-10"><input type="checkbox" id="id_1" value="checked" name="name_0" class="form-control form-control-sm"/></div> 188 $checkbox =
$f->checkbox($label)->withNameFrom($this->name_source)->withDisabled(
true);
194 <div class="form-group row"> 195 <label for="id_1" class="control-label col-sm-4 col-md-3 col-lg-2">label</label> 196 <div class="col-sm-8 col-md-9 col-lg-10"><input type="checkbox" id="id_1" value="checked" name="name_0" disabled="disabled" class="form-control form-control-sm"/></div> 207 $checkbox =
$f->checkbox($label)->withNameFrom($this->name_source);
209 $input_data = $this->createMock(InputData::class);
211 ->expects($this->atLeastOnce())
214 ->willReturn(
"checked");
216 $checkbox_true = $checkbox->withInput($input_data);
218 $this->assertIsBool($checkbox_true->getContent()->value());
219 $this->assertTrue($checkbox_true->getContent()->value());
226 $checkbox =
$f->checkbox($label)->withNameFrom($this->name_source);
228 $input_data = $this->createMock(InputData::class);
230 ->expects($this->atLeastOnce())
235 $checkbox_false = $checkbox->withInput($input_data);
237 $this->assertIsBool($checkbox_false->getContent()->value());
238 $this->assertFalse($checkbox_false->getContent()->value());
245 $checkbox =
$f->checkbox($label)
246 ->withNameFrom($this->name_source)
249 ->withInput($this->createMock(InputData::class))
252 $this->assertIsBool($checkbox->getContent()->value());
253 $this->assertTrue($checkbox->getContent()->value());
260 $new_value =
"NEW_VALUE";
261 $checkbox =
$f->checkbox($label)
262 ->withNameFrom($this->name_source)
265 ->withAdditionalTransformation($this->
refinery->custom()->transformation(
function ($v) use (&$called, $new_value):
string {
269 ->withInput($this->createMock(InputData::class))
272 $this->assertIsString($checkbox->getContent()->value());
273 $this->assertEquals($new_value, $checkbox->getContent()->value());
279 $checkbox =
$f->checkbox(
"label");
280 $checkbox->withValue(null);
281 $this->assertEquals(
false, $checkbox->getValue());
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Provides common functionality for UI tests.