first commit

This commit is contained in:
julien
2026-03-16 01:47:07 +01:00
commit 8f7e61bda0
185 changed files with 27731 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace Tests\Post;
use App\Post\Post;
use PHPUnit\Framework\TestCase;
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());
}
}