feat: event listener sur MangaCreated pour ajouter les chapitres à la création
This commit is contained in:
parent
879b8fa2dc
commit
73774f84ff
@@ -13,6 +13,7 @@ use App\Domain\Manga\Domain\Model\ValueObject\MangaTitle;
|
||||
use App\Tests\Domain\Manga\Adapter\InMemoryMangaProvider;
|
||||
use App\Tests\Domain\Manga\Adapter\InMemoryMangaRepository;
|
||||
use App\Tests\Domain\Manga\Adapter\InMemoryImageProcessor;
|
||||
use App\Tests\Shared\Adapter\InMemoryMessageBus;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class CreateMangaFromMangadexHandlerTest extends TestCase
|
||||
@@ -21,7 +22,7 @@ class CreateMangaFromMangadexHandlerTest extends TestCase
|
||||
private InMemoryMangaRepository $repository;
|
||||
private InMemoryImageProcessor $imageProcessor;
|
||||
private CreateMangaFromMangadexHandler $handler;
|
||||
|
||||
private InMemoryMessageBus $messageBus;
|
||||
protected function setUp(): void
|
||||
{
|
||||
$manga = new Manga(
|
||||
@@ -40,10 +41,12 @@ class CreateMangaFromMangadexHandlerTest extends TestCase
|
||||
$this->provider = new InMemoryMangaProvider([$manga]);
|
||||
$this->repository = new InMemoryMangaRepository();
|
||||
$this->imageProcessor = new InMemoryImageProcessor();
|
||||
$this->messageBus = new InMemoryMessageBus();
|
||||
$this->handler = new CreateMangaFromMangadexHandler(
|
||||
$this->provider,
|
||||
$this->repository,
|
||||
$this->imageProcessor
|
||||
$this->imageProcessor,
|
||||
$this->messageBus
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Domain\Manga\Application\Command\CreateManga;
|
||||
use App\Domain\Manga\Application\CommandHandler\CreateMangaHandler;
|
||||
use App\Tests\Domain\Manga\Adapter\InMemoryMangaRepository;
|
||||
use App\Tests\Domain\Manga\Adapter\InMemoryImageProcessor;
|
||||
use App\Tests\Shared\Adapter\InMemoryMessageBus;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class CreateMangaHandlerTest extends TestCase
|
||||
@@ -13,14 +14,16 @@ class CreateMangaHandlerTest extends TestCase
|
||||
private InMemoryMangaRepository $repository;
|
||||
private InMemoryImageProcessor $imageProcessor;
|
||||
private CreateMangaHandler $handler;
|
||||
|
||||
private InMemoryMessageBus $messageBus;
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->repository = new InMemoryMangaRepository();
|
||||
$this->imageProcessor = new InMemoryImageProcessor();
|
||||
$this->messageBus = new InMemoryMessageBus();
|
||||
$this->handler = new CreateMangaHandler(
|
||||
$this->repository,
|
||||
$this->imageProcessor
|
||||
$this->imageProcessor,
|
||||
$this->messageBus
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,15 +46,13 @@ class FetchMangaChaptersHandlerTest extends TestCase
|
||||
|
||||
$this->mangaRepository->save($manga);
|
||||
|
||||
$this->mangadexClient->setMangaFeed($externalId, [
|
||||
'data' => [
|
||||
[
|
||||
'id' => 'chapter-1',
|
||||
'attributes' => [
|
||||
'chapter' => '1',
|
||||
'title' => 'Chapter 1',
|
||||
'volume' => '1'
|
||||
]
|
||||
$this->mangadexClient->addFeed($externalId, [
|
||||
[
|
||||
'id' => 'chapter-1',
|
||||
'attributes' => [
|
||||
'chapter' => '1',
|
||||
'title' => 'Chapter 1',
|
||||
'volume' => '1'
|
||||
]
|
||||
]
|
||||
]);
|
||||
@@ -75,4 +73,4 @@ class FetchMangaChaptersHandlerTest extends TestCase
|
||||
$command = new FetchMangaChapters($externalId);
|
||||
$this->handler->handle($command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user