first commit

This commit is contained in:
julien
2026-03-20 22:16:20 +01:00
commit 42a4ba3e9a
136 changed files with 10141 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
namespace Tests\Post;
use App\Post\Domain\Entity\Post;
use PHPUnit\Framework\TestCase;
#[\PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations]
final class PostModelEdgeCasesTest extends TestCase
{
public function testFromArrayKeepsMissingOptionalFieldsNull(): void
{
$post = Post::fromArray([
'id' => 3,
'title' => 'Titre',
'content' => '<p>Texte</p>',
'slug' => 'titre',
]);
self::assertSame(3, $post->getId());
self::assertNull($post->getAuthorId());
self::assertNull($post->getAuthorUsername());
self::assertNull($post->getCategoryId());
self::assertNull($post->getCategoryName());
self::assertNull($post->getCategorySlug());
self::assertInstanceOf(\DateTime::class, $post->getCreatedAt());
self::assertInstanceOf(\DateTime::class, $post->getUpdatedAt());
}
}