Test on standard form implementation.
More...
Test on standard form implementation.
Definition at line 49 of file StandardFormTest.php.
◆ buildButtonFactory()
StandardFormTest::buildButtonFactory |
( |
| ) |
|
|
protected |
◆ buildFactory()
StandardFormTest::buildFactory |
( |
| ) |
|
|
protected |
◆ buildInputFactory()
StandardFormTest::buildInputFactory |
( |
| ) |
|
|
protected |
Definition at line 57 of file StandardFormTest.php.
59 $df =
new Data\Factory();
60 $language = $this->createMock(\ilLanguage::class);
Class ChatMainBarProvider .
◆ getUIFactory()
StandardFormTest::getUIFactory |
( |
| ) |
|
◆ test_getPostURL()
StandardFormTest::test_getPostURL |
( |
| ) |
|
◆ test_render()
StandardFormTest::test_render |
( |
| ) |
|
Definition at line 91 of file StandardFormTest.php.
References Vendor\Package\$f, and $url.
97 $form =
$f->standard(
$url, [
98 $if->text(
"label",
"byline"),
105 <form role="form" class="il-standard-form form-horizontal" enctype="multipart/form-data" action="MY_URL" method="post" novalidate="novalidate"> 106 <div class="il-standard-form-header clearfix"> 107 <div class="il-standard-form-cmd"><button class="btn btn-default" data-action="">save</button></div> 109 <div class="form-group row"> 110 <label for="id_1" class="control-label col-sm-3">label</label> 111 <div class="col-sm-9"> 112 <input id="id_1" type="text" name="form_input_1" class="form-control form-control-sm"/> 113 <div class="help-block">byline</div> 116 <div class="il-standard-form-footer clearfix"> 117 <div class="il-standard-form-cmd"><button class="btn btn-default" data-action="">save</button></div>
assertHTMLEquals($expected_html_as_string, $html_as_string)
brutallyTrimHTML($html)
A more radical version of normalizeHTML.
getDefaultRenderer(JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
◆ test_render_no_url()
StandardFormTest::test_render_no_url |
( |
| ) |
|
Definition at line 124 of file StandardFormTest.php.
References Vendor\Package\$f, and $url.
130 $form =
$f->standard(
$url, [
131 $if->text(
"label",
"byline"),
138 <form role="form" class="il-standard-form form-horizontal" enctype="multipart/form-data" method="post" novalidate="novalidate"> 139 <div class="il-standard-form-header clearfix"> 140 <div class="il-standard-form-cmd"><button class="btn btn-default" data-action="">save</button></div> 142 <div class="form-group row"> 143 <label for="id_1" class="control-label col-sm-3">label</label> 144 <div class="col-sm-9"> 145 <input id="id_1" type="text" name="form_input_1" class="form-control form-control-sm"/> 146 <div class="help-block">byline</div> 149 <div class="il-standard-form-footer clearfix"> 150 <div class="il-standard-form-cmd"><button class="btn btn-default" data-action="">save</button></div>
assertHTMLEquals($expected_html_as_string, $html_as_string)
brutallyTrimHTML($html)
A more radical version of normalizeHTML.
getDefaultRenderer(JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
◆ testRenderWithErrorOnField()
StandardFormTest::testRenderWithErrorOnField |
( |
| ) |
|
Definition at line 158 of file StandardFormTest.php.
161 $df =
new Data\Factory();
162 $language = $this->createMock(\ilLanguage::class);
164 ->expects($this->once())
166 ->willReturn(
'testing error message');
168 $refinery = new \ILIAS\Refinery\Factory($df, $language);
177 $fail = $refinery->custom()->constraint(
function ($v) {
179 },
"This is invalid...");
180 $input = $if->text(
"label",
"byline");
182 $input = $input->withAdditionalTransformation($fail);
184 $form =
new Form\Standard($if,
'', [$input]);
186 $request = $this->createMock(ServerRequestInterface::class);
188 ->expects($this->once())
189 ->method(
"getParsedBody")
194 $form = $form->withRequest($request);
195 $this->assertNull($form->getData());
199 <form role="form" class="il-standard-form form-horizontal" enctype="multipart/form-data" method="post" novalidate="novalidate"> 200 <div class="il-standard-form-header clearfix"> 201 <div class="il-standard-form-cmd"><button class="btn btn-default" data-action="">save</button></div> 204 <div class="help-block alert alert-danger" role="alert">testing error message</div> 206 <div class="form-group row"> 207 <label for="id_1" class="control-label col-sm-3">label</label> 208 <div class="col-sm-9"> 209 <div class="help-block alert alert-danger" role="alert">This is invalid...</div> 210 <input id="id_1" type="text" name="form_input_1" class="form-control form-control-sm" /> 211 <div class="help-block">byline</div> 214 <div class="il-standard-form-footer clearfix"> 215 <div class="il-standard-form-cmd"><button class="btn btn-default" data-action="">save</button></div>
assertHTMLEquals($expected_html_as_string, $html_as_string)
brutallyTrimHTML($html)
A more radical version of normalizeHTML.
getDefaultRenderer(JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
◆ testRenderWithErrorOnForm()
StandardFormTest::testRenderWithErrorOnForm |
( |
| ) |
|
Definition at line 223 of file StandardFormTest.php.
226 $df =
new Data\Factory();
227 $language = $this->createMock(\ilLanguage::class);
228 $refinery = new \ILIAS\Refinery\Factory($df, $language);
237 $fail = $refinery->custom()->constraint(
function ($v) {
239 },
"This is a fail on form.");
240 $input = $if->text(
"label",
"byline");
242 $form =
new Form\Standard($if,
'', [$input]);
243 $form = $form->withAdditionalTransformation($fail);
245 $request = $this->createMock(ServerRequestInterface::class);
247 ->expects($this->once())
248 ->method(
"getParsedBody")
253 $form = $form->withRequest($request);
254 $this->assertNull($form->getData());
258 <form role="form" class="il-standard-form form-horizontal" enctype="multipart/form-data" method="post" novalidate="novalidate"> 259 <div class="il-standard-form-header clearfix"> 260 <div class="il-standard-form-cmd"><button class="btn btn-default" data-action="">save</button></div> 263 <div class="help-block alert alert-danger" role="alert">This is a fail on form.</div> 265 <div class="form-group row"> 266 <label for="id_1" class="control-label col-sm-3">label</label> 267 <div class="col-sm-9"> 268 <input id="id_1" type="text" name="form_input_1" class="form-control form-control-sm" /> 269 <div class="help-block">byline</div> 272 <div class="il-standard-form-footer clearfix"> 273 <div class="il-standard-form-cmd"><button class="btn btn-default" data-action="">save</button></div>
assertHTMLEquals($expected_html_as_string, $html_as_string)
brutallyTrimHTML($html)
A more radical version of normalizeHTML.
getDefaultRenderer(JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
◆ testStandardFormRenderWithRequired()
StandardFormTest::testStandardFormRenderWithRequired |
( |
| ) |
|
Definition at line 280 of file StandardFormTest.php.
References Vendor\Package\$f, and $url.
286 $form =
$f->standard(
$url, [$if->text(
"label",
"byline")->withRequired(
true)]);
292 <form role="form" class="il-standard-form form-horizontal" enctype="multipart/form-data" action="MY_URL" method="post" novalidate="novalidate"> 293 <div class="il-standard-form-header clearfix"> 294 <div class="il-standard-form-cmd"><button class="btn btn-default" data-action="">save</button></div> 296 <div class="form-group row"> 297 <label for="id_1" class="control-label col-sm-3">label<span class="asterisk">*</span></label> 298 <div class="col-sm-9"> 299 <input id="id_1" type="text" name="form_input_1" class="form-control form-control-sm"/> 300 <div class="help-block">byline</div> 303 <div class="il-standard-form-footer clearfix"> 304 <span class="asterisk">*</span><span class="small"> required_field</span> 306 <div class="il-standard-form-footer clearfix"> 307 <div class="il-standard-form-cmd"><button class="btn btn-default" data-action="">save</button></div>
assertHTMLEquals($expected_html_as_string, $html_as_string)
brutallyTrimHTML($html)
A more radical version of normalizeHTML.
getDefaultRenderer(JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
The documentation for this class was generated from the following file: