19 declare(strict_types=1);
21 require_once(__DIR__ .
"/../../../../../../../vendor/composer/vendor/autoload.php");
22 require_once(__DIR__ .
"/../../../Base.php");
23 require_once(__DIR__ .
"/CommonFieldRendering.php");
45 $this->data_factory =
new Data\Factory();
51 $this->
lng = $this->createMock(Language::class);
52 $this->
lng->method(
"txt")
53 ->will($this->returnArgument(0));
65 return new I\Input\Field\Factory(
77 public function symbol(): C\Symbol\Factory
90 $format = $this->data_factory->dateFormat()->germanShort();
91 $duration = $this->factory->duration(
'label',
'byline')
92 ->withFormat($format);
103 $duration = $this->factory->duration(
'label',
'byline')
104 ->withMinValue($dat);
115 $duration = $this->factory->duration(
'label',
'byline')
116 ->withMaxValue($dat);
126 $datetime = $this->factory->duration(
'label',
'byline');
127 $this->assertFalse(
$datetime->getUseTime());
128 $this->assertTrue(
$datetime->withUseTime(
true)->getUseTime());
133 $datetime = $this->factory->duration(
'label',
'byline');
134 $this->assertFalse(
$datetime->getTimeOnly());
135 $this->assertTrue(
$datetime->withTimeOnly(
true)->getTimeOnly());
140 $datetime = $this->factory->duration(
'label',
'byline');
141 $this->assertNull(
$datetime->getTimeZone());
142 $tz =
'Europe/Moscow';
145 $datetime->withTimeZone($tz)->getTimeZone()
151 $this->expectException(InvalidArgumentException::class);
152 $datetime = $this->factory->duration(
'label',
'byline');
153 $tz =
'NOT/aValidTZ';
159 $datetime = $this->factory->duration(
'label');
160 $this->assertInstanceOf(
C\Input\Field\Duration::class,
$datetime);
165 $duration = $this->factory->duration(
'label',
'byline')
166 ->withNameFrom($this->name_source);
167 $label_start =
'duration_default_label_start';
168 $label_end =
'duration_default_label_end';
170 $f1 = $this->getFormWrappedHtml(
171 'date-time-field-input',
173 '<div class="c-input-group"> 174 <input id="id_1" type="date" name="name_0/start_1" class="c-field-datetime" /> 182 $f2 = $this->getFormWrappedHtml(
183 'date-time-field-input',
185 '<div class="c-input-group"> 186 <input id="id_2" type="date" name="name_0/end_2" class="c-field-datetime" /> 195 $expected = $this->getFormWrappedHtml(
196 'duration-field-input',
198 '<div class="c-field-duration">' . $f1 . $f2 .
'</div>',
201 $this->assertEquals($expected, $this->render(
$duration));
210 $other_start_label =
'other startlabel';
211 $other_end_label =
'other endlabel';
215 $f1 = $this->getFormWrappedHtml(
216 'date-time-field-input',
218 '<div class="c-input-group"> 219 <input id="id_1" type="date" name="name_0/start_1" class="c-field-datetime" /> 227 $f2 = $this->getFormWrappedHtml(
228 'date-time-field-input',
230 '<div class="c-input-group"> 231 <input id="id_2" type="date" name="name_0/end_2" class="c-field-datetime" /> 240 $expected = $this->getFormWrappedHtml(
241 'duration-field-input',
243 '<div class="c-field-duration">' . $f1 . $f2 .
'</div>',
246 $this->assertEquals($expected, $this->render(
$duration));
251 $duration = $this->factory->duration(
'label')
252 ->withNameFrom($this->name_source);
257 $this->testWithAdditionalOnloadCodeRendersId(
$duration);
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...
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...