3 declare(strict_types=1);
33 protected function setUp(): void
45 $transformedValue = $this->transformation->transform($originVal);
46 $this->assertIsObject($transformedValue);
47 $this->assertInstanceOf(DateTimeImmutable::class, $transformedValue);
48 $this->assertEquals($expectedVal, $transformedValue);
57 $this->expectException(ConstraintViolationException::class);
58 $this->transformation->transform($failingValue);
65 'datetime' => [$now, $now],
66 'iso8601' => [
'2020-07-06T12:23:05+0000',
67 DateTimeImmutable::createFromFormat(DateTimeInterface::ISO8601,
'2020-07-06T12:23:05+0000')],
68 'atom' => [
'2020-07-06T12:23:05+00:00',
69 DateTimeImmutable::createFromFormat(DateTimeInterface::ATOM,
'2020-07-06T12:23:05+00:00')],
70 'rfc3339_ext' => [
'2020-07-06T12:23:05.000+00:00',
71 DateTimeImmutable::createFromFormat(DateTimeInterface::RFC3339_EXTENDED,
'2020-07-06T12:23:05.000+00:00')],
72 'cookie' => [
'Monday, 06-Jul-2020 12:23:05 GMT+0000',
73 DateTimeImmutable::createFromFormat(DateTimeInterface::COOKIE,
'Monday, 06-Jul-2020 12:23:05 GMT+0000')],
74 'rfc822' => [
'Mon, 06 Jul 20 12:23:05 +0000',
75 DateTimeImmutable::createFromFormat(DateTimeInterface::RFC822,
'Mon, 06 Jul 20 12:23:05 +0000')],
76 'rfc7231' => [
'Mon, 06 Jul 2020 12:23:05 GMT',
77 DateTimeImmutable::createFromFormat(DateTimeInterface::RFC7231,
'Mon, 06 Jul 2020 12:23:05 GMT')],
78 'unix_timestamp' => [481556262, DateTimeImmutable::createFromFormat(DateTimeInterface::ISO8601,
'1985-04-05T13:37:42+0000')],
79 'unix_timestamp_float' => [481556262.4, DateTimeImmutable::createFromFormat(DateTimeInterface::ISO8601,
'1985-04-05T13:37:42+0000')]
86 'no_matching_string_format' => [
'hello']
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...