Class TagInputTest.
More...
◆ buildFactory()
TagInputTest::buildFactory |
( |
| ) |
|
|
protected |
Definition at line 34 of file TagInputTest.php.
Referenced by test_implements_factory_interface(), test_max_taglength_tags_not_ok(), test_max_taglength_tags_ok(), test_max_tags_not_ok(), test_max_tags_ok(), test_render(), test_render_error(), test_render_no_byline(), test_render_required(), test_render_value(), test_user_created_not_allowed(), and test_value_required().
36 $df =
new Data\Factory();
40 new Validation\
Factory($df, $this->createMock(\ilLanguage::class)),
◆ setUp()
◆ test_implements_factory_interface()
TagInputTest::test_implements_factory_interface |
( |
| ) |
|
Definition at line 46 of file TagInputTest.php.
References $f, $tag, and buildFactory().
52 [
"lorem",
"ipsum",
"dolor",],
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
◆ test_max_taglength_tags_not_ok()
TagInputTest::test_max_taglength_tags_not_ok |
( |
| ) |
|
Definition at line 236 of file TagInputTest.php.
References $f, and buildFactory().
240 $this->expectException(\InvalidArgumentException::class);
241 $f->tag(
"label", [])->withTagMaxLength(2)->withNameFrom($this->name_source)->withInput(
243 [
"name_0" => [
"lorem",
"ipsum",
"dolor",],]
◆ test_max_taglength_tags_ok()
TagInputTest::test_max_taglength_tags_ok |
( |
| ) |
|
Definition at line 224 of file TagInputTest.php.
References $f, $tag, and buildFactory().
228 $tag =
$f->tag(
"label", [])->withTagMaxLength(10)->withNameFrom($this->name_source)->withInput(
229 new DefPostData([
"name_0" => [
"lorem",
"ipsum",],])
231 $value =
$tag->getContent();
232 $this->assertTrue($value->isOk());
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
◆ test_max_tags_not_ok()
TagInputTest::test_max_tags_not_ok |
( |
| ) |
|
Definition at line 211 of file TagInputTest.php.
References $f, and buildFactory().
215 $this->expectException(\InvalidArgumentException::class);
216 $f->tag(
"label", [])->withMaxTags(2)->withNameFrom($this->name_source)->withInput(
218 [
"name_0" => [
"lorem",
"ipsum",
"dolor",],]
◆ test_max_tags_ok()
TagInputTest::test_max_tags_ok |
( |
| ) |
|
Definition at line 199 of file TagInputTest.php.
References $f, $tag, and buildFactory().
203 $tag =
$f->tag(
"label", [])->withMaxTags(3)->withNameFrom($this->name_source)->withInput(
204 new DefPostData([
"name_0" => [
"lorem",
"ipsum",],])
206 $value =
$tag->getContent();
207 $this->assertTrue($value->isOk());
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
◆ test_render()
TagInputTest::test_render |
( |
| ) |
|
Definition at line 58 of file TagInputTest.php.
References $f, $html, $name, $r, $tags, $text, buildFactory(), ILIAS_UI_TestBase\getDefaultRenderer(), and ILIAS_UI_TestBase\normalizeHTML().
63 $tags = [
"lorem",
"ipsum",
"dolor",];
65 $text =
$f->tag($label,
$tags, $byline)->withNameFrom($this->name_source);
70 $expected =
"<div class=\"form-group row\"> <label for=\"name_0\" class=\"control-label col-sm-3\">label</label> <div class=\"col-sm-9\"> <div id=\"container-id_1\" class=\"form-control form-control-sm il-input-tag\"> <input type=\"text\" id=\"id_1\" value=\"\" class=\"form-control form-control-sm\"/> <input type=\"hidden\" id=\"template-id_1\" value='name_0[]'> </div> <div class=\"help-block\">byline</div> </div></div>";
71 $this->assertEquals($expected,
$html);
getDefaultRenderer(JavaScriptBinding $js_binding=null)
◆ test_render_error()
TagInputTest::test_render_error |
( |
| ) |
|
Definition at line 75 of file TagInputTest.php.
References $f, $html, $name, $r, $tags, $text, buildFactory(), ILIAS_UI_TestBase\getDefaultRenderer(), and ILIAS_UI_TestBase\normalizeHTML().
81 $tags = [
"lorem",
"ipsum",
"dolor",];
83 $text =
$f->tag($label,
$tags, $byline)->withNameFrom($this->name_source)->withError($error);
89 =
"<div class=\"form-group row\"> <label for=\"name_0\" class=\"control-label col-sm-3\">label</label> <div class=\"col-sm-9\"> <div id=\"container-id_1\" class=\"form-control form-control-sm il-input-tag\"> <input type=\"text\" id=\"id_1\" value=\"\" class=\"form-control form-control-sm\"/> <input type=\"hidden\" id=\"template-id_1\" value='name_0[]'> </div> <div class=\"help-block\">byline</div> <div class=\"help-block alert alert-danger\" role=\"alert\"> <img border=\"0\" src=\"./templates/default/images/icon_alert.svg\" alt=\"alert\" /> an_error </div> </div></div>";
90 $this->assertEquals($expected,
$html);
getDefaultRenderer(JavaScriptBinding $js_binding=null)
◆ test_render_no_byline()
TagInputTest::test_render_no_byline |
( |
| ) |
|
Definition at line 94 of file TagInputTest.php.
References $f, $html, $name, $r, $tags, $text, buildFactory(), ILIAS_UI_TestBase\getDefaultRenderer(), and ILIAS_UI_TestBase\normalizeHTML().
99 $tags = [
"lorem",
"ipsum",
"dolor",];
100 $text =
$f->tag($label,
$tags)->withNameFrom($this->name_source);
105 $expected =
"<div class=\"form-group row\"> <label for=\"name_0\" class=\"control-label col-sm-3\">label</label> <div class=\"col-sm-9\"> <div id=\"container-id_1\" class=\"form-control form-control-sm il-input-tag\"> <input type=\"text\" id=\"id_1\" value=\"\" class=\"form-control form-control-sm\"/> <input type=\"hidden\" id=\"template-id_1\" value='name_0[]'> </div> </div></div>";
106 $this->assertEquals($expected,
$html);
getDefaultRenderer(JavaScriptBinding $js_binding=null)
◆ test_render_required()
TagInputTest::test_render_required |
( |
| ) |
|
Definition at line 128 of file TagInputTest.php.
References $f, $html, $name, $r, $tags, $text, buildFactory(), ILIAS_UI_TestBase\getDefaultRenderer(), and ILIAS_UI_TestBase\normalizeHTML().
133 $tags = [
"lorem",
"ipsum",
"dolor",];
134 $text =
$f->tag($label,
$tags)->withNameFrom($this->name_source)->withRequired(
true);
139 $expected =
"<div class=\"form-group row\"> <label for=\"name_0\" class=\"control-label col-sm-3\">label<span class=\"asterisk\">*</span></label> <div class=\"col-sm-9\"> <div id=\"container-id_1\" class=\"form-control form-control-sm il-input-tag\"> <input type=\"text\" id=\"id_1\" value=\"\" class=\"form-control form-control-sm\"/> <input type=\"hidden\" id=\"template-id_1\" value='name_0[]'> </div> </div></div>";
141 $this->assertEquals($expected,
$html);
getDefaultRenderer(JavaScriptBinding $js_binding=null)
◆ test_render_value()
TagInputTest::test_render_value |
( |
| ) |
|
Definition at line 110 of file TagInputTest.php.
References $f, $html, $name, $r, $tags, $text, buildFactory(), ILIAS_UI_TestBase\getDefaultRenderer(), and ILIAS_UI_TestBase\normalizeHTML().
114 $value = [
"lorem",
"ipsum",];
116 $tags = [
"lorem",
"ipsum",
"dolor",];
117 $text =
$f->tag($label,
$tags)->withValue($value)->withNameFrom($this->name_source);
123 =
"<div class=\"form-group row\"> <label for=\"name_0\" class=\"control-label col-sm-3\">label</label> <div class=\"col-sm-9\"> <div id=\"container-id_1\" class=\"form-control form-control-sm il-input-tag\"> <input type=\"text\" id=\"id_1\" value=\"lorem,ipsum\" class=\"form-control form-control-sm\"/> <input type=\"hidden\" id=\"template-id_1\" value='name_0[]'> <input type=\"hidden\" id=\"tag-id_1-lorem\" name=\"name_0[]\" value='lorem'> <input type=\"hidden\" id=\"tag-id_1-ipsum\" name=\"name_0[]\" value='ipsum'> </div> </div></div>";
124 $this->assertEquals($expected,
$html);
getDefaultRenderer(JavaScriptBinding $js_binding=null)
◆ test_user_created_not_allowed()
TagInputTest::test_user_created_not_allowed |
( |
| ) |
|
Definition at line 170 of file TagInputTest.php.
References $f, $tag, $tags, and buildFactory().
173 $tags = [
"lorem",
"ipsum",
"dolor",];
174 $tag =
$f->tag(
"label",
$tags)->withUserCreatedTagsAllowed(
false)->withNameFrom($this->name_source);
176 $tag1 =
$tag->withInput(
178 [
"name_0" => [
"lorem",
"ipsum",],]
181 $value1 = $tag1->getContent();
182 $this->assertTrue($value1->isOk());
183 $value = $value1->value();
189 $tag1 =
$tag->withInput(
191 [
"name_0" => [
"conseptetuer",
"ipsum",],]
194 $value1 = $tag1->getContent();
195 $this->assertTrue($value1->isError());
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
◆ test_value_required()
TagInputTest::test_value_required |
( |
| ) |
|
Definition at line 145 of file TagInputTest.php.
References $f, $name, $tag, $tags, and buildFactory().
150 $tags = [
"lorem",
"ipsum",
"dolor",];
151 $tag =
$f->tag($label,
$tags)->withNameFrom($this->name_source)->withRequired(
true);
153 $raw_value1 = [
"lorem",
"ipsum",];
155 $value1 = $tag1->getContent();
156 $this->assertTrue($value1->isOk());
157 $value = $value1->value();
158 $this->assertEquals($raw_value1, $value);
161 $value2 = $tag2->getContent();
162 $this->assertTrue($value2->isError());
165 $value2 = $tag2->getContent();
166 $this->assertTrue($value2->isError());
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
◆ $name_source
TagInputTest::$name_source |
|
private |
The documentation for this class was generated from the following file: