19 declare(strict_types=1);
    21 require_once(__DIR__ . 
"/../../../../../../../vendor/composer/vendor/autoload.php");
    22 require_once(__DIR__ . 
"/../../../Base.php");
    23 require_once(__DIR__ . 
"/InputTest.php");
    24 require_once(__DIR__ . 
"/CommonFieldRendering.php");
    45         $f = $this->getFieldFactory();
    47         $text = 
$f->text(
"label", 
"byline");
    50         $this->assertInstanceOf(Field\Text::class, 
$text);
    55         $f = $this->getFieldFactory();
    58         $text = 
$f->text($label, $byline)->withNameFrom($this->name_source);
    59         $expected = $this->getFormWrappedHtml(
    62             '<input id="id_1" type="text" name="name_0" class="c-field-text" />',
    66         $this->assertEquals($expected, $this->render(
$text));
    71         $f = $this->getFieldFactory();
    73         $text = 
$f->text($label)->withNameFrom($this->name_source);
    75         $this->testWithError(
$text);
    76         $this->testWithNoByline(
$text);
    77         $this->testWithRequired(
$text);
    78         $this->testWithDisabled(
$text);
    79         $this->testWithAdditionalOnloadCodeRendersId(
$text);
    84         $f = $this->getFieldFactory();
    87         $text = 
$f->text($label)->withValue($value)->withNameFrom($this->name_source);
    88         $expected = $this->getFormWrappedHtml(
    91             '<input id="id_1" type="text" value="value" name="name_0" class="c-field-text" />',
    95         $this->assertEquals($expected, $this->render(
$text));
   100         $f = $this->getFieldFactory();
   105         $this->assertEquals(4, 
$text->getMaxLength());
   107         $text1 = 
$text->withValue(
"1234");
   108         $this->assertEquals(
"1234", $text1->getValue());
   110         $this->expectException(InvalidArgumentException::class);
   111         $this->expectExceptionMessage(
"Argument 'value': Display value does not match input type.");
   112         $text->withValue(
"12345");
   117         $f = $this->getFieldFactory();
   119         $text = 
$f->text($label)->withNameFrom($this->name_source)->withMaxLength(8);
   120         $expected = $this->getFormWrappedHtml(
   123             '<input id="id_1" type="text" name="name_0" maxlength="8" class="c-field-text" />',
   127         $this->assertEquals($expected, $this->render(
$text));
   132         $f = $this->getFieldFactory();
   135         $text = 
$f->text($label)->withNameFrom($this->name_source)->withRequired(
true);
   138         $value1 = $text1->getContent();
   139         $this->assertTrue($value1->isOk());
   140         $this->assertEquals(
"0", $value1->value());
   143         $value2 = $text2->getContent();
   144         $this->assertTrue($value2->isError());
   149         $f = $this->getFieldFactory();
   152             ->withNameFrom($this->name_source)
   153             ->withInput(
new DefInputData([$name => 
"<script>alert()</script>"]));
   155         $content = 
$text->getContent();
   156         $this->assertEquals(
"alert()", $content->value());
 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...
 
testImplementsFactoryInterface()
 
DefNamesource $name_source
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...