Skip to content

Commit b2f2ea3

Browse files
committed
add dates
1 parent 8f9b881 commit b2f2ea3

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

tests/Fixtures/TestBundle/Entity/JsonStreamResource.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ class JsonStreamResource
3333
#[ORM\Column(length: 255)]
3434
public string $title;
3535

36-
// #[ORM\Column(type: 'datetime_immutable')]
37-
// public \DateTimeImmutable $createdAt;
38-
//
39-
// #[ORM\Column(type: 'date_immutable')]
40-
// public \DateTimeImmutable $publishedAt;
36+
#[ORM\Column(type: 'datetime_immutable')]
37+
public \DateTimeImmutable $createdAt;
38+
39+
#[ORM\Column(type: 'date_immutable')]
40+
public \DateTimeImmutable $publishedAt;
4141

4242
#[ORM\Column(type: 'integer')]
4343
public int $views;

tests/Functional/JsonStreamerTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ protected function setUp(): void
6363
for ($i = 0; $i < 10; ++$i) {
6464
$resource = new JsonStreamResource();
6565
$resource->title = 'Title '.$i;
66-
// $resource->createdAt = new \DateTimeImmutable();
67-
// $resource->publishedAt = new \DateTimeImmutable();
66+
$resource->createdAt = new \DateTimeImmutable();
67+
$resource->publishedAt = new \DateTimeImmutable();
6868
$resource->views = random_int(1, 1000);
6969
$resource->rating = random_int(1, 5);
7070
$resource->isFeatured = (bool) random_int(0, 1);
@@ -171,6 +171,8 @@ public function testJsonStreamerWrite(): void
171171
'json' => [
172172
'title' => 'asd',
173173
'views' => 0,
174+
'createdAt' => '2024-01-01T12:00:00+00:00',
175+
'publishedAt' => '2024-01-01T12:00:00+00:00',
174176
'rating' => 0.0,
175177
'isFeatured' => false,
176178
'price' => '0.00',
@@ -181,6 +183,7 @@ public function testJsonStreamerWrite(): void
181183

182184
$res = json_decode($buffer, true);
183185

186+
$this->assertResponseIsSuccessful();
184187
$this->assertSame('asd', $res['title']);
185188
$this->assertSame(0, $res['views']);
186189
$this->assertSame(0, $res['rating']);

0 commit comments

Comments
 (0)