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(
78 public function symbol(): I\Symbol\Factory
91 $format = $this->data_factory->dateFormat()->germanShort();
93 ->withFormat($format);
105 ->withMinValue($dat);
117 ->withMaxValue($dat);
128 $this->assertFalse(
$datetime->getUseTime());
129 $this->assertTrue(
$datetime->withUseTime(
true)->getUseTime());
135 $this->assertFalse(
$datetime->getTimeOnly());
136 $this->assertTrue(
$datetime->withTimeOnly(
true)->getTimeOnly());
142 $this->assertNull(
$datetime->getTimeZone());
143 $tz =
'Europe/Moscow';
146 $datetime->withTimeZone($tz)->getTimeZone()
152 $this->expectException(InvalidArgumentException::class);
154 $tz =
'NOT/aValidTZ';
161 $this->assertInstanceOf(
C\Input\Field\Duration::class,
$datetime);
167 ->withNameFrom($this->name_source);
168 $label_start =
'duration_default_label_start';
169 $label_end =
'duration_default_label_end';
171 $f1 = $this->getFormWrappedHtml(
172 'date-time-field-input',
174 '<div class="c-input-group"> 175 <input id="id_1" type="date" name="name_0/start_1" class="c-field-datetime" /> 183 $f2 = $this->getFormWrappedHtml(
184 'date-time-field-input',
186 '<div class="c-input-group"> 187 <input id="id_2" type="date" name="name_0/end_2" class="c-field-datetime" /> 196 $expected = $this->getFormWrappedHtml(
197 'duration-field-input',
199 '<div class="c-field-duration">' . $f1 . $f2 .
'</div>',
202 $this->assertEquals($expected, $this->render(
$duration));
206 #[\PHPUnit\Framework\Attributes\Depends('testRender')] 209 $other_start_label =
'other startlabel';
210 $other_end_label =
'other endlabel';
214 $f1 = $this->getFormWrappedHtml(
215 'date-time-field-input',
217 '<div class="c-input-group"> 218 <input id="id_1" type="date" name="name_0/start_1" class="c-field-datetime" /> 226 $f2 = $this->getFormWrappedHtml(
227 'date-time-field-input',
229 '<div class="c-input-group"> 230 <input id="id_2" type="date" name="name_0/end_2" class="c-field-datetime" /> 239 $expected = $this->getFormWrappedHtml(
240 'duration-field-input',
242 '<div class="c-field-duration">' . $f1 . $f2 .
'</div>',
245 $this->assertEquals($expected, $this->render(
$duration));
251 ->withNameFrom($this->name_source);
256 $this->testWithAdditionalOnloadCodeRendersId(
$duration);
Interface Observer Contains several chained tasks and infos about them.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null