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");
    41         $this->
refinery = 
new Refinery($this->createMock(
Data\Factory::class), $this->createMock(
ILIAS\Language\Language::class));
    46         $f = $this->getFieldFactory();
    48         $checkbox = 
$f->checkbox(
"label", 
"byline");
    50         $this->assertInstanceOf(\
ILIAS\
UI\
Component\Input\Container\Form\FormInput::class, $checkbox);
    51         $this->assertInstanceOf(Field\Checkbox::class, $checkbox);
    56         $f = $this->getFieldFactory();
    59         $checkbox = 
$f->checkbox($label, $byline)->withNameFrom($this->name_source);
    60         $expected = $this->getFormWrappedHtml(
    61             'checkbox-field-input',
    63             '<input type="checkbox" id="id_1" value="checked" name="name_0" class="c-field-checkbox" />',
    67         $this->assertEquals($expected, $this->render($checkbox));
    72         $f = $this->getFieldFactory();
    75         $checkbox = 
$f->checkbox($label)->withValue($value)->withNameFrom($this->name_source);
    77         $expected = 
'<input type="checkbox" id="id_1" value="checked" checked="checked" name="name_0" class="c-field-checkbox" />';
    78         $this->assertStringContainsString($expected, $this->render($checkbox));
    83         $f = $this->getFieldFactory();
    87             $f->checkbox($label)->withValue($value);
    90             $this->assertTrue(
true);
    96         $f = $this->getFieldFactory();
    98         $checkbox = 
$f->checkbox($label, null)->withNameFrom($this->name_source);
   100         $this->testWithError($checkbox);
   101         $this->testWithNoByline($checkbox);
   102         $this->testWithRequired($checkbox);
   103         $this->testWithDisabled($checkbox);
   104         $this->testWithAdditionalOnloadCodeRendersId($checkbox);
   109         $f = $this->getFieldFactory();
   111         $checkbox = 
$f->checkbox($label)->withNameFrom($this->name_source);
   113         $input_data = $this->createMock(InputData::class);
   115             ->expects($this->atLeastOnce())
   118             ->willReturn(
"checked");
   120         $checkbox_true = $checkbox->withInput($input_data);
   122         $this->assertIsBool($checkbox_true->getContent()->value());
   123         $this->assertTrue($checkbox_true->getContent()->value());
   128         $f = $this->getFieldFactory();
   130         $checkbox = 
$f->checkbox($label)->withNameFrom($this->name_source);
   132         $input_data = $this->createMock(InputData::class);
   134             ->expects($this->atLeastOnce())
   139         $checkbox_false = $checkbox->withInput($input_data);
   141         $this->assertIsBool($checkbox_false->getContent()->value());
   142         $this->assertFalse($checkbox_false->getContent()->value());
   147         $f = $this->getFieldFactory();
   149         $checkbox = 
$f->checkbox($label)
   150             ->withNameFrom($this->name_source)
   153             ->withInput($this->createMock(InputData::class))
   156         $this->assertIsBool($checkbox->getContent()->value());
   157         $this->assertTrue($checkbox->getContent()->value());
   162         $f = $this->getFieldFactory();
   164         $new_value = 
"NEW_VALUE";
   165         $checkbox = 
$f->checkbox($label)
   166             ->withNameFrom($this->name_source)
   169             ->withAdditionalTransformation($this->
refinery->custom()->transformation(
function ($v) use (&$called, $new_value): 
string {
   173             ->withInput($this->createMock(InputData::class))
   176         $this->assertIsString($checkbox->getContent()->value());
   177         $this->assertEquals($new_value, $checkbox->getContent()->value());
   182         $f = $this->getFieldFactory();
   183         $checkbox = 
$f->checkbox(
"label");
   184         $checkbox->withValue(null);
   185         $this->assertEquals(
false, $checkbox->getValue());
 
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...
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...