Test on form implementation.
More...
Test on form implementation.
Definition at line 85 of file FormTest.php.
◆ buildButtonFactory()
FormTest::buildButtonFactory |
( |
| ) |
|
|
protected |
Definition at line 114 of file FormTest.php.
116 return new I\Button\Factory();
◆ buildDataFactory()
FormTest::buildDataFactory |
( |
| ) |
|
Definition at line 133 of file FormTest.php.
135 return new Data\Factory();
◆ buildFactory()
FormTest::buildFactory |
( |
| ) |
|
|
protected |
Definition at line 93 of file FormTest.php.
93 : Input\Container\Form\Factory
95 return new Input\Container\Form\Factory(
◆ buildInputFactory()
FormTest::buildInputFactory |
( |
| ) |
|
|
protected |
Definition at line 101 of file FormTest.php.
References ILIAS\UI\examples\Symbol\Glyph\Language\language().
101 : Input\Field\Factory
103 $df =
new Data\Factory();
105 return new Input\Field\Factory(
Interface Observer Contains several chained tasks and infos about them.
language()
description: > Example for rendring a language glyph.
◆ buildTransformation()
FormTest::buildTransformation |
( |
Closure |
$trafo | ) |
|
|
protected |
◆ getUIFactory()
FormTest::getUIFactory |
( |
| ) |
|
◆ inputMock()
- Returns
- Input|mixed|MockObject
Definition at line 432 of file FormTest.php.
436 ->getMockBuilder(
Input\Field\FormInputInternal::class)
455 "withAdditionalTransformation",
456 "getUpdateOnLoadCode",
459 "withAdditionalOnLoadCode",
463 "withResetTriggeredSignals",
464 "getTriggeredSignals" 466 ->setMockClassName(
"Mock_InputNo" . ($no++))
◆ testExtractPostData()
FormTest::testExtractPostData |
( |
| ) |
|
Definition at line 168 of file FormTest.php.
171 $request = $this->createMock(ServerRequestInterface::class);
173 ->expects($this->once())
174 ->method(
"getParsedBody")
176 $input_data = $form->_extractRequestData($request);
177 $this->assertInstanceOf(InputData::class, $input_data);
◆ testFormWithoutRequiredField()
FormTest::testFormWithoutRequiredField |
( |
| ) |
|
◆ testFormWithRequiredField()
FormTest::testFormWithRequiredField |
( |
| ) |
|
Definition at line 480 of file FormTest.php.
References Vendor\Package\$f.
485 $if->text(
"")->withRequired(
true),
489 $this->assertTrue($form->hasRequiredInputs());
◆ testGetData()
FormTest::testGetData |
( |
| ) |
|
Definition at line 258 of file FormTest.php.
261 $request = $this->createMock(ServerRequestInterface::class);
263 ->expects($this->once())
264 ->method(
"getParsedBody")
269 ->expects($this->once())
270 ->method(
"getContent")
271 ->willReturn($df->ok(1));
273 ->expects($this->once())
274 ->method(
"withInput")
275 ->willReturn($input_1);
279 ->expects($this->once())
280 ->method(
"getContent")
281 ->willReturn($df->ok(2));
283 ->expects($this->once())
284 ->method(
"withInput")
285 ->willReturn($input_2);
288 $form->setInputs([$input_1, $input_2]);
289 $form = $form->withRequest($request);
290 $this->assertEquals([1, 2], $form->getData());
◆ testGetDataFaulty()
FormTest::testGetDataFaulty |
( |
| ) |
|
Definition at line 328 of file FormTest.php.
References ILIAS\UI\examples\Symbol\Glyph\Language\language(), and null.
331 $request = $this->createMock(ServerRequestInterface::class);
333 ->expects($this->once())
334 ->method(
"getParsedBody")
339 ->expects($this->once())
340 ->method(
"getContent")
341 ->willReturn($df->error(
"error"));
343 ->expects($this->once())
344 ->method(
"withInput")
345 ->willReturn($input_1);
349 ->expects($this->once())
350 ->method(
"getContent")
351 ->willReturn($df->ok(2));
353 ->expects($this->once())
354 ->method(
"withInput")
355 ->willReturn($input_2);
358 $form->setInputs([
"foo" => $input_1,
"bar" => $input_2]);
360 $i18n =
"THERE IS SOME ERROR IN THIS GROUP";
362 ->expects($this->once())
364 ->with(
"ui_error_in_group")
368 $form = $form->withRequest($request);
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
language()
description: > Example for rendring a language glyph.
◆ testGetDataRespectsKeys()
FormTest::testGetDataRespectsKeys |
( |
| ) |
|
Definition at line 293 of file FormTest.php.
296 $request = $this->createMock(ServerRequestInterface::class);
298 ->expects($this->once())
299 ->method(
"getParsedBody")
304 ->expects($this->once())
305 ->method(
"getContent")
306 ->willReturn($df->ok(1));
308 ->expects($this->once())
309 ->method(
"withInput")
310 ->willReturn($input_1);
314 ->expects($this->once())
315 ->method(
"getContent")
316 ->willReturn($df->ok(2));
318 ->expects($this->once())
319 ->method(
"withInput")
320 ->willReturn($input_2);
323 $form->setInputs([
"foo" => $input_1,
"bar" => $input_2]);
324 $form = $form->withRequest($request);
325 $this->assertEquals([
"foo" => 1,
"bar" => 2], $form->getData());
◆ testGetInputs()
FormTest::testGetInputs |
( |
| ) |
|
Definition at line 138 of file FormTest.php.
References FixedNameSource\$name.
144 $inputs = [$if->text(
""), $if->text(
"")];
148 $form_inputs = $form->getInputs();
149 $this->assertSameSize(
$inputs, $form_inputs);
151 foreach ($form_inputs as $input) {
152 $name = $input->getName();
153 $name_source->name = $name;
156 $this->assertIsString($name);
159 $input = array_shift($form_inputs);
160 $this->assertEquals($input->withNameFrom($name_source), $input);
163 $this->assertNotContains($name, $seen_names);
164 $seen_names[] = $name;
◆ testNameInputsRespectsKeys()
FormTest::testNameInputsRespectsKeys |
( |
| ) |
|
Definition at line 414 of file FormTest.php.
419 "foo" => $if->text(
""),
425 $named_inputs = $form->getInputs();
426 $this->assertEquals(array_keys(
$inputs), array_keys($named_inputs));
◆ testWithAdditionalTransformation()
FormTest::testWithAdditionalTransformation |
( |
| ) |
|
Definition at line 372 of file FormTest.php.
375 $request = $this->createMock(ServerRequestInterface::class);
377 ->expects($this->once())
378 ->method(
"getParsedBody")
383 ->expects($this->once())
384 ->method(
"getContent")
385 ->willReturn($df->ok(1));
387 ->expects($this->once())
388 ->method(
"withInput")
389 ->willReturn($input_1);
393 ->expects($this->once())
394 ->method(
"getContent")
395 ->willReturn($df->ok(2));
397 ->expects($this->once())
398 ->method(
"withInput")
399 ->willReturn($input_2);
402 $form->setInputs([$input_1, $input_2]);
405 return "transformed";
408 $this->assertNotSame($form2, $form);
409 $form2 = $form2->withRequest($request);
411 $this->assertEquals(
"transformed", $form2->getData());
◆ testWithRequest()
FormTest::testWithRequest |
( |
| ) |
|
Definition at line 180 of file FormTest.php.
183 $request = $this->createMock(ServerRequestInterface::class);
184 $input_data = $this->createMock(InputData::class);
188 ->expects($this->once())
189 ->method(
"withInput")
191 ->willReturn($input_1);
193 ->expects($this->once())
194 ->method(
"getContent")
195 ->willReturn($df->ok(0));
199 ->expects($this->once())
200 ->method(
"withInput")
202 ->willReturn($input_2);
204 ->expects($this->once())
205 ->method(
"getContent")
206 ->willReturn($df->ok(0));
209 $form->setInputs([$input_1, $input_2]);
210 $form->input_data = $input_data;
212 $form2 = $form->withRequest($request);
214 $this->assertNotSame($form2, $form);
215 $this->assertInstanceOf(Form::class, $form2);
216 $this->assertEquals([$input_1, $input_2], $form2->getInputs());
◆ testWithRequestRespectsKeys()
FormTest::testWithRequestRespectsKeys |
( |
| ) |
|
Definition at line 219 of file FormTest.php.
222 $request = $this->createMock(ServerRequestInterface::class);
223 $input_data = $this->createMock(InputData::class);
227 ->expects($this->once())
228 ->method(
"withInput")
230 ->willReturn($input_1);
232 ->expects($this->once())
233 ->method(
"getContent")
234 ->willReturn($df->ok(0));
238 ->expects($this->once())
239 ->method(
"withInput")
241 ->willReturn($input_2);
243 ->expects($this->once())
244 ->method(
"getContent")
245 ->willReturn($df->ok(0));
248 $form->setInputs([
"foo" => $input_1,
"bar" => $input_2]);
249 $form->input_data = $input_data;
251 $form2 = $form->withRequest($request);
253 $this->assertNotSame($form2, $form);
254 $this->assertInstanceOf(Form::class, $form2);
255 $this->assertEquals([
"foo" => $input_1,
"bar" => $input_2], $form2->getInputs());
◆ $inputs
◆ $language
The documentation for this class was generated from the following file:
- components/ILIAS/UI/tests/Component/Input/Container/Form/FormTest.php