From c16d2e7e61b02c9a07633a1f5ad8ff723948c20c Mon Sep 17 00:00:00 2001 From: Rinsvent Date: Sat, 6 Nov 2021 15:23:18 +0700 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/unit/Converter/FillTest.php | 2 ++ tests/unit/Converter/fixtures/FillTest/HelloRequest.php | 3 +++ tests/unit/Converter/fixtures/FillTest/HelloSchema.php | 1 + 3 files changed, 6 insertions(+) diff --git a/tests/unit/Converter/FillTest.php b/tests/unit/Converter/FillTest.php index 30151d0..2a69884 100644 --- a/tests/unit/Converter/FillTest.php +++ b/tests/unit/Converter/FillTest.php @@ -78,6 +78,7 @@ class FillTest extends \Codeception\Test\Unit new CollectionItem('2'), ]; $helloRequest->collection = $collection; + $helloRequest->createdAt = new \DateTimeImmutable('2020-05-21 13:36:22'); $dto = $dto2DataConverter->convert($helloRequest); // codecept_debug(json_encode($dto)); @@ -127,6 +128,7 @@ class FillTest extends \Codeception\Test\Unit 'value' => '2', ], ], + 'createdAt' => '2020-05-21T13:36:22+00:00' ], $dto); } } diff --git a/tests/unit/Converter/fixtures/FillTest/HelloRequest.php b/tests/unit/Converter/fixtures/FillTest/HelloRequest.php index fab3d2c..c6f40b3 100644 --- a/tests/unit/Converter/fixtures/FillTest/HelloRequest.php +++ b/tests/unit/Converter/fixtures/FillTest/HelloRequest.php @@ -4,6 +4,7 @@ namespace Rinsvent\DTO2Data\Tests\unit\Converter\fixtures\FillTest; use Rinsvent\DTO2Data\Attribute\DataPath; use Rinsvent\DTO2Data\Attribute\PropertyPath; +use Rinsvent\DTO2Data\Transformer\DateTimeFormat; use Rinsvent\DTO2Data\Transformer\Trim; #[HelloSchema] @@ -22,4 +23,6 @@ class HelloRequest #[PropertyPath(path: 'uuid.id')] public UUID $uuid; public Collection $collection; + #[DateTimeFormat] + public \DateTimeImmutable $createdAt; } diff --git a/tests/unit/Converter/fixtures/FillTest/HelloSchema.php b/tests/unit/Converter/fixtures/FillTest/HelloSchema.php index f5a84c1..16a8787 100644 --- a/tests/unit/Converter/fixtures/FillTest/HelloSchema.php +++ b/tests/unit/Converter/fixtures/FillTest/HelloSchema.php @@ -30,5 +30,6 @@ class HelloSchema extends Schema 'collection' => [ 'value' ], + 'createdAt' ]; }