Refatoring : Working state
This commit is contained in:
@@ -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>');
|
||||
|
||||
Reference in New Issue
Block a user