Test on form implementation.
More...
Test on form implementation.
Definition at line 85 of file FormTest.php.
◆ buildButtonFactory()
FormTest::buildButtonFactory |
( |
| ) |
|
|
protected |
Definition at line 115 of file FormTest.php.
117 return new I\Button\Factory();
◆ buildDataFactory()
FormTest::buildDataFactory |
( |
| ) |
|
Definition at line 134 of file FormTest.php.
136 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 433 of file FormTest.php.
437 ->getMockBuilder(
Input\Field\FormInputInternal::class)
456 "withAdditionalTransformation",
457 "getUpdateOnLoadCode",
460 "withAdditionalOnLoadCode",
464 "withResetTriggeredSignals",
465 "getTriggeredSignals",
468 ->setMockClassName(
"Mock_InputNo" . ($no++))
◆ testExtractPostData()
FormTest::testExtractPostData |
( |
| ) |
|
Definition at line 169 of file FormTest.php.
172 $request = $this->createMock(ServerRequestInterface::class);
174 ->expects($this->once())
175 ->method(
"getParsedBody")
177 $input_data = $form->_extractRequestData($request);
178 $this->assertInstanceOf(InputData::class, $input_data);
◆ testFormWithoutRequiredField()
FormTest::testFormWithoutRequiredField |
( |
| ) |
|
◆ testFormWithRequiredField()
FormTest::testFormWithRequiredField |
( |
| ) |
|
Definition at line 482 of file FormTest.php.
References Vendor\Package\$f.
487 $if->text(
"")->withRequired(
true),
491 $this->assertTrue($form->hasRequiredInputs());
◆ testGetData()
FormTest::testGetData |
( |
| ) |
|
Definition at line 259 of file FormTest.php.
262 $request = $this->createMock(ServerRequestInterface::class);
264 ->expects($this->once())
265 ->method(
"getParsedBody")
270 ->expects($this->once())
271 ->method(
"getContent")
272 ->willReturn($df->ok(1));
274 ->expects($this->once())
275 ->method(
"withInput")
276 ->willReturn($input_1);
280 ->expects($this->once())
281 ->method(
"getContent")
282 ->willReturn($df->ok(2));
284 ->expects($this->once())
285 ->method(
"withInput")
286 ->willReturn($input_2);
289 $form->setInputs([$input_1, $input_2]);
290 $form = $form->withRequest($request);
291 $this->assertEquals([1, 2], $form->getData());
◆ testGetDataFaulty()
FormTest::testGetDataFaulty |
( |
| ) |
|
Definition at line 329 of file FormTest.php.
References ILIAS\UI\examples\Symbol\Glyph\Language\language(), and null.
332 $request = $this->createMock(ServerRequestInterface::class);
334 ->expects($this->once())
335 ->method(
"getParsedBody")
340 ->expects($this->once())
341 ->method(
"getContent")
342 ->willReturn($df->error(
"error"));
344 ->expects($this->once())
345 ->method(
"withInput")
346 ->willReturn($input_1);
350 ->expects($this->once())
351 ->method(
"getContent")
352 ->willReturn($df->ok(2));
354 ->expects($this->once())
355 ->method(
"withInput")
356 ->willReturn($input_2);
359 $form->setInputs([
"foo" => $input_1,
"bar" => $input_2]);
361 $i18n =
"THERE IS SOME ERROR IN THIS GROUP";
363 ->expects($this->once())
365 ->with(
"ui_error_in_group")
369 $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 294 of file FormTest.php.
297 $request = $this->createMock(ServerRequestInterface::class);
299 ->expects($this->once())
300 ->method(
"getParsedBody")
305 ->expects($this->once())
306 ->method(
"getContent")
307 ->willReturn($df->ok(1));
309 ->expects($this->once())
310 ->method(
"withInput")
311 ->willReturn($input_1);
315 ->expects($this->once())
316 ->method(
"getContent")
317 ->willReturn($df->ok(2));
319 ->expects($this->once())
320 ->method(
"withInput")
321 ->willReturn($input_2);
324 $form->setInputs([
"foo" => $input_1,
"bar" => $input_2]);
325 $form = $form->withRequest($request);
326 $this->assertEquals([
"foo" => 1,
"bar" => 2], $form->getData());
◆ testGetInputs()
FormTest::testGetInputs |
( |
| ) |
|
Definition at line 139 of file FormTest.php.
References FixedNameSource\$name.
145 $inputs = [$if->text(
""), $if->text(
"")];
149 $form_inputs = $form->getInputs();
150 $this->assertSameSize(
$inputs, $form_inputs);
152 foreach ($form_inputs as $input) {
153 $name = $input->getName();
154 $name_source->name = $name;
157 $this->assertIsString($name);
160 $input = array_shift($form_inputs);
161 $this->assertEquals($input->withNameFrom($name_source), $input);
164 $this->assertNotContains($name, $seen_names);
165 $seen_names[] = $name;
◆ testNameInputsRespectsKeys()
FormTest::testNameInputsRespectsKeys |
( |
| ) |
|
Definition at line 415 of file FormTest.php.
420 "foo" => $if->text(
""),
426 $named_inputs = $form->getInputs();
427 $this->assertEquals(array_keys(
$inputs), array_keys($named_inputs));
◆ testWithAdditionalTransformation()
FormTest::testWithAdditionalTransformation |
( |
| ) |
|
Definition at line 373 of file FormTest.php.
376 $request = $this->createMock(ServerRequestInterface::class);
378 ->expects($this->once())
379 ->method(
"getParsedBody")
384 ->expects($this->once())
385 ->method(
"getContent")
386 ->willReturn($df->ok(1));
388 ->expects($this->once())
389 ->method(
"withInput")
390 ->willReturn($input_1);
394 ->expects($this->once())
395 ->method(
"getContent")
396 ->willReturn($df->ok(2));
398 ->expects($this->once())
399 ->method(
"withInput")
400 ->willReturn($input_2);
403 $form->setInputs([$input_1, $input_2]);
406 return "transformed";
409 $this->assertNotSame($form2, $form);
410 $form2 = $form2->withRequest($request);
412 $this->assertEquals(
"transformed", $form2->getData());
◆ testWithRequest()
FormTest::testWithRequest |
( |
| ) |
|
Definition at line 181 of file FormTest.php.
184 $request = $this->createMock(ServerRequestInterface::class);
185 $input_data = $this->createMock(InputData::class);
189 ->expects($this->once())
190 ->method(
"withInput")
192 ->willReturn($input_1);
194 ->expects($this->once())
195 ->method(
"getContent")
196 ->willReturn($df->ok(0));
200 ->expects($this->once())
201 ->method(
"withInput")
203 ->willReturn($input_2);
205 ->expects($this->once())
206 ->method(
"getContent")
207 ->willReturn($df->ok(0));
210 $form->setInputs([$input_1, $input_2]);
211 $form->input_data = $input_data;
213 $form2 = $form->withRequest($request);
215 $this->assertNotSame($form2, $form);
216 $this->assertInstanceOf(Form::class, $form2);
217 $this->assertEquals([$input_1, $input_2], $form2->getInputs());
◆ testWithRequestRespectsKeys()
FormTest::testWithRequestRespectsKeys |
( |
| ) |
|
Definition at line 220 of file FormTest.php.
223 $request = $this->createMock(ServerRequestInterface::class);
224 $input_data = $this->createMock(InputData::class);
228 ->expects($this->once())
229 ->method(
"withInput")
231 ->willReturn($input_1);
233 ->expects($this->once())
234 ->method(
"getContent")
235 ->willReturn($df->ok(0));
239 ->expects($this->once())
240 ->method(
"withInput")
242 ->willReturn($input_2);
244 ->expects($this->once())
245 ->method(
"getContent")
246 ->willReturn($df->ok(0));
249 $form->setInputs([
"foo" => $input_1,
"bar" => $input_2]);
250 $form->input_data = $input_data;
252 $form2 = $form->withRequest($request);
254 $this->assertNotSame($form2, $form);
255 $this->assertInstanceOf(Form::class, $form2);
256 $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