Test on form implementation.
More...
Test on form implementation.
Definition at line 85 of file FormTest.php.
◆ buildButtonFactory()
| FormTest::buildButtonFactory |
( |
| ) |
|
|
protected |
Definition at line 111 of file FormTest.php.
113 return new I\Button\Factory();
◆ buildDataFactory()
| FormTest::buildDataFactory |
( |
| ) |
|
Definition at line 130 of file FormTest.php.
132 return new Data\Factory();
◆ buildFactory()
| FormTest::buildFactory |
( |
| ) |
|
|
protected |
Definition at line 93 of file FormTest.php.
93 : Input\Container\Form\Factory
◆ buildInputFactory()
| FormTest::buildInputFactory |
( |
| ) |
|
|
protected |
Definition at line 98 of file FormTest.php.
References ILIAS\UI\examples\Symbol\Glyph\Language\language().
100 $df =
new Data\Factory();
101 $this->
language = $this->createMock(ilLanguage::class);
102 return new Input\Field\Factory(
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
◆ buildTransformation()
| FormTest::buildTransformation |
( |
Closure |
$trafo | ) |
|
|
protected |
◆ getUIFactory()
| FormTest::getUIFactory |
( |
| ) |
|
◆ inputMock()
- Returns
- Input|mixed|MockObject
Definition at line 429 of file FormTest.php.
433 ->getMockBuilder(
Input\Field\FormInputInternal::class)
452 "withAdditionalTransformation",
453 "getUpdateOnLoadCode",
456 "withAdditionalOnLoadCode",
460 "withResetTriggeredSignals",
461 "getTriggeredSignals" 463 ->setMockClassName(
"Mock_InputNo" . ($no++))
◆ testExtractPostData()
| FormTest::testExtractPostData |
( |
| ) |
|
Definition at line 165 of file FormTest.php.
168 $request = $this->createMock(ServerRequestInterface::class);
170 ->expects($this->once())
171 ->method(
"getParsedBody")
173 $input_data = $form->_extractRequestData($request);
174 $this->assertInstanceOf(InputData::class, $input_data);
◆ testFormWithoutRequiredField()
| FormTest::testFormWithoutRequiredField |
( |
| ) |
|
◆ testFormWithRequiredField()
| FormTest::testFormWithRequiredField |
( |
| ) |
|
Definition at line 477 of file FormTest.php.
References Vendor\Package\$f.
482 $if->text(
"")->withRequired(
true),
486 $this->assertTrue($form->hasRequiredInputs());
◆ testGetData()
| FormTest::testGetData |
( |
| ) |
|
Definition at line 255 of file FormTest.php.
258 $request = $this->createMock(ServerRequestInterface::class);
260 ->expects($this->once())
261 ->method(
"getParsedBody")
266 ->expects($this->once())
267 ->method(
"getContent")
268 ->willReturn($df->ok(1));
270 ->expects($this->once())
271 ->method(
"withInput")
272 ->willReturn($input_1);
276 ->expects($this->once())
277 ->method(
"getContent")
278 ->willReturn($df->ok(2));
280 ->expects($this->once())
281 ->method(
"withInput")
282 ->willReturn($input_2);
285 $form->setInputs([$input_1, $input_2]);
286 $form = $form->withRequest($request);
287 $this->assertEquals([1, 2], $form->getData());
◆ testGetDataFaulty()
| FormTest::testGetDataFaulty |
( |
| ) |
|
Definition at line 325 of file FormTest.php.
References ILIAS\UI\examples\Symbol\Glyph\Language\language().
328 $request = $this->createMock(ServerRequestInterface::class);
330 ->expects($this->once())
331 ->method(
"getParsedBody")
336 ->expects($this->once())
337 ->method(
"getContent")
338 ->willReturn($df->error(
"error"));
340 ->expects($this->once())
341 ->method(
"withInput")
342 ->willReturn($input_1);
346 ->expects($this->once())
347 ->method(
"getContent")
348 ->willReturn($df->ok(2));
350 ->expects($this->once())
351 ->method(
"withInput")
352 ->willReturn($input_2);
355 $form->setInputs([
"foo" => $input_1,
"bar" => $input_2]);
357 $i18n =
"THERE IS SOME ERROR IN THIS GROUP";
359 ->expects($this->once())
361 ->with(
"ui_error_in_group")
365 $form = $form->withRequest($request);
366 $this->assertEquals(null, null);
◆ testGetDataRespectsKeys()
| FormTest::testGetDataRespectsKeys |
( |
| ) |
|
Definition at line 290 of file FormTest.php.
293 $request = $this->createMock(ServerRequestInterface::class);
295 ->expects($this->once())
296 ->method(
"getParsedBody")
301 ->expects($this->once())
302 ->method(
"getContent")
303 ->willReturn($df->ok(1));
305 ->expects($this->once())
306 ->method(
"withInput")
307 ->willReturn($input_1);
311 ->expects($this->once())
312 ->method(
"getContent")
313 ->willReturn($df->ok(2));
315 ->expects($this->once())
316 ->method(
"withInput")
317 ->willReturn($input_2);
320 $form->setInputs([
"foo" => $input_1,
"bar" => $input_2]);
321 $form = $form->withRequest($request);
322 $this->assertEquals([
"foo" => 1,
"bar" => 2], $form->getData());
◆ testGetInputs()
| FormTest::testGetInputs |
( |
| ) |
|
Definition at line 135 of file FormTest.php.
References FixedNameSource\$name.
141 $inputs = [$if->text(
""), $if->text(
"")];
145 $form_inputs = $form->getInputs();
146 $this->assertSameSize(
$inputs, $form_inputs);
148 foreach ($form_inputs as $input) {
149 $name = $input->getName();
150 $name_source->name = $name;
153 $this->assertIsString($name);
156 $input = array_shift($form_inputs);
157 $this->assertEquals($input->withNameFrom($name_source), $input);
160 $this->assertNotContains($name, $seen_names);
161 $seen_names[] = $name;
◆ testNameInputsRespectsKeys()
| FormTest::testNameInputsRespectsKeys |
( |
| ) |
|
Definition at line 411 of file FormTest.php.
416 "foo" => $if->text(
""),
422 $named_inputs = $form->getInputs();
423 $this->assertEquals(array_keys(
$inputs), array_keys($named_inputs));
◆ testWithAdditionalTransformation()
| FormTest::testWithAdditionalTransformation |
( |
| ) |
|
Definition at line 369 of file FormTest.php.
372 $request = $this->createMock(ServerRequestInterface::class);
374 ->expects($this->once())
375 ->method(
"getParsedBody")
380 ->expects($this->once())
381 ->method(
"getContent")
382 ->willReturn($df->ok(1));
384 ->expects($this->once())
385 ->method(
"withInput")
386 ->willReturn($input_1);
390 ->expects($this->once())
391 ->method(
"getContent")
392 ->willReturn($df->ok(2));
394 ->expects($this->once())
395 ->method(
"withInput")
396 ->willReturn($input_2);
399 $form->setInputs([$input_1, $input_2]);
402 return "transformed";
405 $this->assertNotSame($form2, $form);
406 $form2 = $form2->withRequest($request);
408 $this->assertEquals(
"transformed", $form2->getData());
◆ testWithRequest()
| FormTest::testWithRequest |
( |
| ) |
|
Definition at line 177 of file FormTest.php.
180 $request = $this->createMock(ServerRequestInterface::class);
181 $input_data = $this->createMock(InputData::class);
185 ->expects($this->once())
186 ->method(
"withInput")
188 ->willReturn($input_1);
190 ->expects($this->once())
191 ->method(
"getContent")
192 ->willReturn($df->ok(0));
196 ->expects($this->once())
197 ->method(
"withInput")
199 ->willReturn($input_2);
201 ->expects($this->once())
202 ->method(
"getContent")
203 ->willReturn($df->ok(0));
206 $form->setInputs([$input_1, $input_2]);
207 $form->input_data = $input_data;
209 $form2 = $form->withRequest($request);
211 $this->assertNotSame($form2, $form);
212 $this->assertInstanceOf(Form::class, $form2);
213 $this->assertEquals([$input_1, $input_2], $form2->getInputs());
◆ testWithRequestRespectsKeys()
| FormTest::testWithRequestRespectsKeys |
( |
| ) |
|
Definition at line 216 of file FormTest.php.
219 $request = $this->createMock(ServerRequestInterface::class);
220 $input_data = $this->createMock(InputData::class);
224 ->expects($this->once())
225 ->method(
"withInput")
227 ->willReturn($input_1);
229 ->expects($this->once())
230 ->method(
"getContent")
231 ->willReturn($df->ok(0));
235 ->expects($this->once())
236 ->method(
"withInput")
238 ->willReturn($input_2);
240 ->expects($this->once())
241 ->method(
"getContent")
242 ->willReturn($df->ok(0));
245 $form->setInputs([
"foo" => $input_1,
"bar" => $input_2]);
246 $form->input_data = $input_data;
248 $form2 = $form->withRequest($request);
250 $this->assertNotSame($form2, $form);
251 $this->assertInstanceOf(Form::class, $form2);
252 $this->assertEquals([
"foo" => $input_1,
"bar" => $input_2], $form2->getInputs());
◆ $inputs
◆ $language
The documentation for this class was generated from the following file: