6 require_once(
'./libs/composer/vendor/autoload.php');
32 $transformedValue = $this->transformation->transform($originVal);
33 $this->assertIsObject($transformedValue);
34 $this->assertInstanceOf(\DateTimeImmutable::class, $transformedValue);
35 $this->assertEquals($expectedVal, $transformedValue);
44 $this->expectException(ConstraintViolationException::class);
45 $this->transformation->transform($failingValue);
50 $now = new \DateTimeImmutable();
52 'datetime' => [$now, $now],
53 'iso8601' => [
'2020-07-06T12:23:05+0000',\DateTimeImmutable::createFromFormat(\DateTimeImmutable::ISO8601,
'2020-07-06T12:23:05+0000')],
54 'atom' => [
'2020-07-06T12:23:05+00:00',\DateTimeImmutable::createFromFormat(\DateTimeImmutable::ATOM,
'2020-07-06T12:23:05+00:00')],
55 'rfc3339_ext' => [
'2020-07-06T12:23:05.000+00:00',\DateTimeImmutable::createFromFormat(\DateTimeImmutable::RFC3339_EXTENDED,
'2020-07-06T12:23:05.000+00:00')],
56 'cookie' => [
'Monday, 06-Jul-2020 12:23:05 GMT+0000',\DateTimeImmutable::createFromFormat(\DateTimeImmutable::COOKIE,
'Monday, 06-Jul-2020 12:23:05 GMT+0000')],
57 'rfc822' => [
'Mon, 06 Jul 20 12:23:05 +0000',\DateTimeImmutable::createFromFormat(\DateTimeImmutable::RFC822,
'Mon, 06 Jul 20 12:23:05 +0000')],
58 'rfc7231' => [
'Mon, 06 Jul 2020 12:23:05 GMT',\DateTimeImmutable::createFromFormat(\DateTimeImmutable::RFC7231,
'Mon, 06 Jul 2020 12:23:05 GMT')],
59 'unix_timestamp' => [481556262, \DateTimeImmutable::createFromFormat(\DateTimeImmutable::ISO8601,
'1985-04-05T13:37:42+0000')],
60 'unix_timestamp_float' => [481556262.4, \DateTimeImmutable::createFromFormat(\DateTimeImmutable::ISO8601,
'1985-04-05T13:37:42+0000')]
67 'no_matching_string_format' => [
'hello']