Добавил тест

master v0.0.7
Rinsvent 3 years ago
parent e3290afe79
commit c16d2e7e61
  1. 2
      tests/unit/Converter/FillTest.php
  2. 3
      tests/unit/Converter/fixtures/FillTest/HelloRequest.php
  3. 1
      tests/unit/Converter/fixtures/FillTest/HelloSchema.php

@ -78,6 +78,7 @@ class FillTest extends \Codeception\Test\Unit
new CollectionItem('2'), new CollectionItem('2'),
]; ];
$helloRequest->collection = $collection; $helloRequest->collection = $collection;
$helloRequest->createdAt = new \DateTimeImmutable('2020-05-21 13:36:22');
$dto = $dto2DataConverter->convert($helloRequest); $dto = $dto2DataConverter->convert($helloRequest);
// codecept_debug(json_encode($dto)); // codecept_debug(json_encode($dto));
@ -127,6 +128,7 @@ class FillTest extends \Codeception\Test\Unit
'value' => '2', 'value' => '2',
], ],
], ],
'createdAt' => '2020-05-21T13:36:22+00:00'
], $dto); ], $dto);
} }
} }

@ -4,6 +4,7 @@ namespace Rinsvent\DTO2Data\Tests\unit\Converter\fixtures\FillTest;
use Rinsvent\DTO2Data\Attribute\DataPath; use Rinsvent\DTO2Data\Attribute\DataPath;
use Rinsvent\DTO2Data\Attribute\PropertyPath; use Rinsvent\DTO2Data\Attribute\PropertyPath;
use Rinsvent\DTO2Data\Transformer\DateTimeFormat;
use Rinsvent\DTO2Data\Transformer\Trim; use Rinsvent\DTO2Data\Transformer\Trim;
#[HelloSchema] #[HelloSchema]
@ -22,4 +23,6 @@ class HelloRequest
#[PropertyPath(path: 'uuid.id')] #[PropertyPath(path: 'uuid.id')]
public UUID $uuid; public UUID $uuid;
public Collection $collection; public Collection $collection;
#[DateTimeFormat]
public \DateTimeImmutable $createdAt;
} }

@ -30,5 +30,6 @@ class HelloSchema extends Schema
'collection' => [ 'collection' => [
'value' 'value'
], ],
'createdAt'
]; ];
} }

Loading…
Cancel
Save