From 64a334c63e9eadefa6029a337a1fc79705bc0b12 Mon Sep 17 00:00:00 2001 From: Yisroel Baum Date: Wed, 6 May 2026 22:27:18 +0300 Subject: [PATCH] test Post entity feature slot --- backend/tests/Unit/Post/PostTest.php | 50 ++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 backend/tests/Unit/Post/PostTest.php diff --git a/backend/tests/Unit/Post/PostTest.php b/backend/tests/Unit/Post/PostTest.php new file mode 100644 index 0000000..bbd5594 --- /dev/null +++ b/backend/tests/Unit/Post/PostTest.php @@ -0,0 +1,50 @@ +assertSame(7, $post->getId()); + $this->assertSame(3, $post->getUserId()); + $this->assertSame('Hello', $post->getTitle()); + $this->assertSame('World', $post->getBody()); + $this->assertSame($createdAt, $post->getCreatedAt()); + $this->assertSame(1, $post->getFeatureSlot()); + $this->assertTrue($post->isFeatured()); + } + + public function test_post_with_null_feature_slot_is_not_featured(): void + { + $post = new Post( + id: 1, + userId: 1, + title: 't', + body: 'b', + createdAt: new DateTimeImmutable('2026-05-06T12:00:00Z'), + featureSlot: null, + ); + + $this->assertNull($post->getFeatureSlot()); + $this->assertFalse($post->isFeatured()); + } +}