5require_once(__DIR__ .
"/../../../../../libs/composer/vendor/autoload.php");
6require_once(__DIR__ .
"/../../../Base.php");
7require_once(__DIR__ .
"/InputTest.php");
12use \ILIAS\UI\Component\Input\Field;
15use \ILIAS\Transformation;
25 return 'some alternative value';
43 new Validation\
Factory($df, $this->createMock(\ilLanguage::class)),
52 $pwd =
$f->password(
"label",
"byline");
53 $this->assertInstanceOf(Field\Input::class, $pwd);
54 $this->assertInstanceOf(Field\Password::class, $pwd);
64 $pwd =
$f->password($label, $byline)->withNameFrom($this->name_source);
68 .
"<div class=\"form-group row\">"
69 .
"<label for=\"$name\" class=\"control-label col-sm-3\">$label</label>"
70 .
"<div class=\"col-sm-9\">"
71 .
"<div class=\"il-input-password\">"
72 .
"<input type=\"password\" name=\"$name\" class=\"form-control form-control-sm\" />"
74 .
"<div class=\"help-block\">$byline</div>"
88 $pwd =
$f->password($label, $byline)->withNameFrom($this->name_source)->withError($error);
93 .
"<div class=\"form-group row\">"
94 .
" <label for=\"$name\" class=\"control-label col-sm-3\">$label</label>"
95 .
" <div class=\"col-sm-9\">"
96 .
" <div class=\"il-input-password\">"
97 .
" <input type=\"password\" name=\"$name\" class=\"form-control form-control-sm\" />"
99 .
" <div class=\"help-block\">$byline</div>"
100 .
" <div class=\"help-block alert alert-danger\" role=\"alert\">"
101 .
" <img border=\"0\" src=\"./templates/default/images/icon_alert.svg\" alt=\"alert\" />"
108 $expected = preg_replace(
'!\s+!',
' ', $expected);
110 $expected = explode(
' ', $expected);
111 $this->assertEquals($expected,
$html);
120 $pwd =
$f->password($label)->withNameFrom($this->name_source);
124 .
"<div class=\"form-group row\">"
125 .
"<label for=\"$name\" class=\"control-label col-sm-3\">$label</label>"
126 .
"<div class=\"col-sm-9\">"
127 .
"<div class=\"il-input-password\">"
128 .
"<input type=\"password\" name=\"$name\" class=\"form-control form-control-sm\" />"
142 $pwd =
$f->password($label)->withValue($value)->withNameFrom($this->name_source);
146 .
"<div class=\"form-group row\">"
147 .
"<label for=\"$name\" class=\"control-label col-sm-3\">$label</label>"
148 .
"<div class=\"col-sm-9\">"
149 .
"<div class=\"il-input-password\">"
150 .
"<input type=\"password\" name=\"$name\" value=\"$value\" class=\"form-control form-control-sm\" />"
163 $pwd =
$f->password($label)->withNameFrom($this->name_source)->withRequired(
true);
169 .
"<div class=\"form-group row\">"
170 .
"<label for=\"$name\" class=\"control-label col-sm-3\">" .
"$label"
171 .
"<span class=\"asterisk\">*</span>"
173 .
"<div class=\"col-sm-9\">"
174 .
"<div class=\"il-input-password\">"
175 .
"<input type=\"password\" name=\"$name\" class=\"form-control form-control-sm\" />"
188 $pwd =
$f->password($label)->withNameFrom($this->name_source)->withRequired(
true);
191 $value1 = $pwd1->getContent();
192 $this->assertTrue($value1->isOk());
195 $value2 = $pwd2->getContent();
196 $this->assertTrue($value2->isError());
203 $pwd =
$f->password($label);
204 $this->assertNull($pwd->getValue());
207 $pwd = $pwd->withInput(
$post);
208 $this->assertEquals(
$post->getOr(
'',
''), $pwd->getValue());
209 $this->assertInstanceOf(PWD::class, $pwd->getContent()->value());
An exception for terminatinating execution or to throw for unit testing.
A password is used as part of credentials for authentication.
Provides common functionality for UI tests.
assertHTMLEquals($expected_html_as_string, $html_as_string)
getDefaultRenderer(JavaScriptBinding $js_binding=null)
getOr($name, $default)
Get a named value from the data and fallback to default if that name does not exist.
Describes how Input-Elements want to interact with posted data.