19 declare(strict_types=1);
    21 require_once(__DIR__ . 
"/../../../Base.php");
    22 require_once(__DIR__ . 
"/CommonFieldRendering.php");
    51         $options = [
"one" => 
"Eins", 
"two" => 
"Zwei", 
"three" => 
"Drei"];
    53             $this->createMock(
ILIAS\
Data\Factory::class),
    60         $this->assertTrue($select->_isClientSideValueOk(
"one"));
    61         $this->assertTrue($select->_isClientSideValueOk(
"two"));
    62         $this->assertTrue($select->_isClientSideValueOk(
"three"));
    63         $this->assertFalse($select->_isClientSideValueOk(
"four"));
    70             $this->createMock(
ILIAS\
Data\Factory::class),
    77         $this->assertTrue($select->_isClientSideValueOk(
""));
    83         $select = $this->getFieldFactory()->select(
    89         ->withNameFrom($this->name_source);
    91         $data = $this->createMock(InputData::class);
    92         $data->expects($this->once())
    95         $select = $select->withInput(
    99         $this->assertNotEquals(null, $select->getError());
   106             $this->createMock(
ILIAS\
Data\Factory::class),
   113         $this->assertTrue($select->_isClientSideValueOk(
""));
   118         $f = $this->getFieldFactory();
   121         $options = [
"one" => 
"One", 
"two" => 
"Two", 
"three" => 
"Three"];
   122         $select = 
$f->select(
$label, 
$options, $byline)->withNameFrom($this->name_source);
   123         $expected = $this->getFormWrappedHtml(
   124             'select-field-input',
   127             <select id="id_1" name="name_0">   128                 <option selected="selected" value="">-</option>   129                 <option value="one">One</option>   130                 <option value="two">Two</option>   131                 <option value="three">Three</option>   137         $this->assertEquals($expected, $this->render($select));
   143         $f = $this->getFieldFactory();
   146         $options = [
"one" => 
"One", 
"two" => 
"Two", 
"three" => 
"Three"];
   147         $select = 
$f->select(
$label, 
$options, $byline)->withNameFrom($this->name_source)->withValue(
"one");
   148         $expected = $this->getFormWrappedHtml(
   149             'select-field-input',
   152             <select id="id_1" name="name_0">   153                 <option value="">-</option>   154                 <option selected="selected" value="one">One</option>   155                 <option value="two">Two</option>   156                 <option value="three">Three</option>   162         $this->assertEquals($expected, $this->render($select));
   167         $f = $this->getFieldFactory();
   169         $select = 
$f->select(
$label, [], null)->withNameFrom($this->name_source);
   171         $this->testWithError($select);
   172         $this->testWithNoByline($select);
   173         $this->testWithRequired($select);
   174         $this->testWithDisabled($select);
   175         $this->testWithAdditionalOnloadCodeRendersId($select);
   181         $f = $this->getFieldFactory();
   184         $options = [
"something_value" => 
"something"];
   186                     ->withNameFrom($this->name_source);
   188         $html_without = $this->brutallyTrimHTML($this->getDefaultRenderer()->render($select));
   190         $this->assertTrue(str_contains($html_without, 
">-</option>"));
   191         $this->assertTrue(str_contains($html_without, 
"value=\"\""));
   193         $select = $select->withRequired(
true);
   194         $html_with_required = $this->brutallyTrimHTML($this->getDefaultRenderer()->render($select));
   196         $this->assertTrue(str_contains($html_with_required, 
">ui_select_dropdown_label</option>"));
   197         $this->assertTrue(str_contains($html_with_required, 
"value=\"\""));
   199         $select = $select->withRequired(
false)->withValue(
"something_value");
   200         $html_with_value = $this->brutallyTrimHTML($this->getDefaultRenderer()->render($select));
   202         $this->assertTrue(str_contains($html_with_value, 
">-</option>"));
   203         $this->assertTrue(str_contains($html_with_value, 
"value=\"\""));
   205         $select = $select->withRequired(
true);
   207         $html_with_value_and_required = $this->brutallyTrimHTML($this->getDefaultRenderer()->render($select));
   209         $this->assertFalse(str_contains($html_with_value_and_required, 
">-</option>"));
   210         $this->assertFalse(str_contains($html_with_value_and_required, 
"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. 
 
_isClientSideValueOk($value)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...