19 declare(strict_types=1);
    21 require_once(__DIR__ . 
"/../../../../Base.php");
    49     public ?Input\InputData $input_data = null;
    56         $this->input_factory = $input_factory;
    62         return $this->extractRequestData($request);
    67         if ($this->input_data !== null) {
    68             return $this->input_data;
    71         return parent::extractRequestData($request);
    77         $this->input_group = $this->input_factory->group($inputs);
    95         return new Input\Container\Form\Factory(
    96             $this->buildInputFactory(),
   103         $df = 
new Data\Factory();
   105         return new Input\Field\Factory(
   116         return new I\Button\Factory();
   121         $dataFactory = 
new Data\Factory();
   122         $language = $this->createMock(
ILIAS\
Language\Language::class);
   125         return $refinery->custom()->transformation($trafo);
   135         return new Data\Factory();
   140         $this->buildFactory();
   141         $if = $this->buildInputFactory();
   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;
   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);
   182         $df = $this->buildDataFactory();
   183         $request = $this->createMock(ServerRequestInterface::class);
   184         $input_data = $this->createMock(InputData::class);
   186         $input_1 = $this->inputMock();
   188             ->expects($this->once())
   189             ->method(
"withInput")
   191             ->willReturn($input_1);
   193             ->expects($this->once())
   194             ->method(
"getContent")
   195             ->willReturn($df->ok(0));
   197         $input_2 = $this->inputMock();
   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());
   221         $df = $this->buildDataFactory();
   222         $request = $this->createMock(ServerRequestInterface::class);
   223         $input_data = $this->createMock(InputData::class);
   225         $input_1 = $this->inputMock();
   227             ->expects($this->once())
   228             ->method(
"withInput")
   230             ->willReturn($input_1);
   232             ->expects($this->once())
   233             ->method(
"getContent")
   234             ->willReturn($df->ok(0));
   236         $input_2 = $this->inputMock();
   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());
   260         $df = $this->buildDataFactory();
   261         $request = $this->createMock(ServerRequestInterface::class);
   263             ->expects($this->once())
   264             ->method(
"getParsedBody")
   267         $input_1 = $this->inputMock();
   269             ->expects($this->once())
   270             ->method(
"getContent")
   271             ->willReturn($df->ok(1));
   273             ->expects($this->once())
   274             ->method(
"withInput")
   275             ->willReturn($input_1);
   277         $input_2 = $this->inputMock();
   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());
   295         $df = $this->buildDataFactory();
   296         $request = $this->createMock(ServerRequestInterface::class);
   298             ->expects($this->once())
   299             ->method(
"getParsedBody")
   302         $input_1 = $this->inputMock();
   304             ->expects($this->once())
   305             ->method(
"getContent")
   306             ->willReturn($df->ok(1));
   308             ->expects($this->once())
   309             ->method(
"withInput")
   310             ->willReturn($input_1);
   312         $input_2 = $this->inputMock();
   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());
   330         $df = $this->buildDataFactory();
   331         $request = $this->createMock(ServerRequestInterface::class);
   333             ->expects($this->once())
   334             ->method(
"getParsedBody")
   337         $input_1 = $this->inputMock();
   339             ->expects($this->once())
   340             ->method(
"getContent")
   341             ->willReturn($df->error(
"error"));
   343             ->expects($this->once())
   344             ->method(
"withInput")
   345             ->willReturn($input_1);
   347         $input_2 = $this->inputMock();
   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);
   369         $this->assertEquals(null, null);
   374         $df = $this->buildDataFactory();
   375         $request = $this->createMock(ServerRequestInterface::class);
   377             ->expects($this->once())
   378             ->method(
"getParsedBody")
   381         $input_1 = $this->inputMock();
   383             ->expects($this->once())
   384             ->method(
"getContent")
   385             ->willReturn($df->ok(1));
   387             ->expects($this->once())
   388             ->method(
"withInput")
   389             ->willReturn($input_1);
   391         $input_2 = $this->inputMock();
   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]);
   404         $form2 = $form->withAdditionalTransformation($this->buildTransformation(
function () {
   405             return "transformed";
   408         $this->assertNotSame($form2, $form);
   409         $form2 = $form2->withRequest($request);
   411         $this->assertEquals(
"transformed", $form2->getData());
   416         $if = $this->buildInputFactory();
   419             "foo" => $if->text(
""),
   424         $form->setInputs($inputs);
   425         $named_inputs = $form->getInputs();
   426         $this->assertEquals(array_keys($inputs), array_keys($named_inputs));
   436             ->getMockBuilder(
Input\Field\FormInputInternal::class)
   455                 "withAdditionalTransformation",
   456                 "getUpdateOnLoadCode",
   459                 "withAdditionalOnLoadCode",
   463                 "withResetTriggeredSignals",
   464                 "getTriggeredSignals"   466             ->setMockClassName(
"Mock_InputNo" . ($no++))
   472         $f = $this->buildFactory();
   473         $if = $this->buildInputFactory();
   474         $inputs = [$if->text(
""), $if->text(
"")];
   477         $this->assertFalse($form->hasRequiredInputs());
   482         $f = $this->buildFactory();
   483         $if = $this->buildInputFactory();
   485             $if->text(
"")->withRequired(
true),
   489         $this->assertTrue($form->hasRequiredInputs());
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Interface Observer  Contains several chained tasks and infos about them. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
getNewName()
Generates a unique name on every call. 
 
__construct(Container $dic, ilPlugin $plugin)
 
language()
 description: > Example for rendring a language glyph. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...