Refatoring : Working state

This commit is contained in:
julien
2026-03-16 16:58:54 +01:00
parent 0453697cd3
commit e0f7c77d6e
54 changed files with 287 additions and 279 deletions

View File

@@ -4,9 +4,9 @@ declare(strict_types=1);
namespace Tests\Post;
use App\Post\Post;
use App\Post\Infrastructure\PdoPostRepository as PostRepository;
use App\Post\Infrastructure\PdoPostRepository;
use App\Post\PostRepositoryInterface;
use App\Post\Application\PostApplicationService as PostService;
use App\Post\Application\PostApplicationService;
use App\Shared\Database\Migrator;
use App\Shared\Exception\NotFoundException;
use App\Shared\Html\HtmlSanitizerInterface;
@@ -34,11 +34,11 @@ final class PostConcurrentUpdateIntegrationTest extends TestCase
public function testUpdatePostThrowsWhenRowDisappearsBetweenReadAndWrite(): void
{
$realRepo = new PostRepository($this->db);
$realRepo = new PdoPostRepository($this->db);
$repo = new class($realRepo) implements PostRepositoryInterface {
private bool $deleted = false;
public function __construct(private readonly PostRepository $inner) {}
public function __construct(private readonly PdoPostRepository $inner) {}
public function findAll(?int $categoryId = null): array { return $this->inner->findAll($categoryId); }
public function findPage(int $limit, int $offset, ?int $categoryId = null): array { return $this->inner->findPage($limit, $offset, $categoryId); }
@@ -70,7 +70,7 @@ final class PostConcurrentUpdateIntegrationTest extends TestCase
public function sanitize(string $html): string { return $html; }
};
$service = new PostService($repo, $sanitizer);
$service = new PostApplicationService($repo, $sanitizer);
$this->expectException(NotFoundException::class);
$service->updatePost(1, 'Titre modifié', '<p>Contenu modifié</p>');