19 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");
38 public function get(
string $name):
string 48 return 'some alternative value';
71 $df =
new Data\Factory();
72 $language = $this->createMock(ilLanguage::class);
73 return new I\Input\Field\Factory(
84 $f = $this->buildFactory();
85 $pwd =
$f->password(
"label",
"byline");
87 $this->assertInstanceOf(Field\Password::class, $pwd);
92 $f = $this->buildFactory();
96 $pwd =
$f->password($label, $byline)->withNameFrom($this->name_source);
98 $r = $this->getDefaultRenderer();
100 <div class="form-group row"> 101 <label for="id_1" class="control-label col-sm-4 col-md-3 col-lg-2">' . $label .
'</label> 102 <div class="col-sm-8 col-md-9 col-lg-10"> 103 <div class="il-input-password" id="id_1_container"> 104 <input id="id_1" type="password" name="' .
$name .
'" class="form-control form-control-sm" /> 106 <div class="help-block">' . $byline .
'</div> 109 $this->assertHTMLEquals($expected, $r->render($pwd));
114 $f = $this->buildFactory();
118 $pwd =
$f->password($label, $byline)->withNameFrom($this->name_source)->withError($error);
120 $r = $this->getDefaultRenderer();
121 $html = $this->brutallyTrimHTML($r->render($pwd));
122 $expected = $this->brutallyTrimHTML(
' 123 <div class="form-group row"> 124 <label for="id_1" class="control-label col-sm-4 col-md-3 col-lg-2">label</label> 125 <div class="col-sm-8 col-md-9 col-lg-10"> 126 <div class="help-block alert alert-danger" aria-describedby="id_1" role="alert">an_error</div> 127 <div class="il-input-password" id="id_1_container"><input id="id_1" type="password" name="name_0" class="form-control form-control-sm" /></div> 128 <div class="help-block">byline</div> 132 $this->assertEquals($expected, $html);
137 $f = $this->buildFactory();
140 $pwd =
$f->password($label)->withNameFrom($this->name_source);
142 $r = $this->getDefaultRenderer();
144 <div class="form-group row"> 145 <label for="id_1" class="control-label col-sm-4 col-md-3 col-lg-2">' . $label .
'</label> 146 <div class="col-sm-8 col-md-9 col-lg-10"> 147 <div class="il-input-password" id="id_1_container"> 148 <input id="id_1" type="password" name="' .
$name .
'" class="form-control form-control-sm" /> 152 $this->assertHTMLEquals($expected, $r->render($pwd));
157 $f = $this->buildFactory();
161 $pwd =
$f->password($label)->withValue($value)->withNameFrom($this->name_source);
163 $r = $this->getDefaultRenderer();
165 <div class="form-group row"> 166 <label for="id_1" class="control-label col-sm-4 col-md-3 col-lg-2">' . $label .
'</label> 167 <div class="col-sm-8 col-md-9 col-lg-10"> 168 <div class="il-input-password" id="id_1_container"> 169 <input id="id_1" type="password" name="' .
$name .
'" value="' . $value .
'" class="form-control form-control-sm" /> 173 $this->assertHTMLEquals($expected, $r->render($pwd));
178 $f = $this->buildFactory();
181 $pwd =
$f->password($label)->withNameFrom($this->name_source)->withRequired(
true);
183 $r = $this->getDefaultRenderer();
184 $html = $r->render($pwd);
187 <div class="form-group row"> 188 <label for="id_1" class="control-label col-sm-4 col-md-3 col-lg-2">' . $label .
'<span class="asterisk">*</span></label> 189 <div class="col-sm-8 col-md-9 col-lg-10"> 190 <div class="il-input-password" id="id_1_container"> 191 <input id="id_1" type="password" name="' .
$name .
'" class="form-control form-control-sm" /> 195 $this->assertHTMLEquals($expected, $html);
200 $f = $this->buildFactory();
203 $pwd =
$f->password($label)->withNameFrom($this->name_source)->withDisabled(
true);
205 $r = $this->getDefaultRenderer();
206 $html = $r->render($pwd);
209 <div class="form-group row"> 210 <label for="id_1" class="control-label col-sm-4 col-md-3 col-lg-2">' . $label .
'</label> 211 <div class="col-sm-8 col-md-9 col-lg-10"> 212 <div class="il-input-password" id="id_1_container"> 213 <input id="id_1" type="password" name="' .
$name .
'" disabled="disabled" class="form-control form-control-sm" /> 217 $this->assertHTMLEquals($expected, $html);
222 $f = $this->buildFactory();
225 $pwd =
$f->password($label)->withNameFrom($this->name_source)->withRequired(
true);
228 $value1 = $pwd1->getContent();
229 $this->assertTrue($value1->isOk());
232 $value2 = $pwd2->getContent();
233 $this->assertTrue($value2->isError());
238 $f = $this->buildFactory();
240 $pwd =
$f->password($label)->withNameFrom($this->name_source);
241 $this->assertNull($pwd->getValue());
244 $pwd = $pwd->withInput($post);
245 $this->assertEquals($post->getOr(
'',
''), $pwd->getValue());
246 $this->assertInstanceOf(PWD::class, $pwd->getContent()->value());
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...
Provides common functionality for UI tests.