diff --git a/src/Application/UseCases/Campaign/Create/CreateCampaign.php b/src/Application/UseCases/Campaign/Create/CreateCampaign.php index fd7525a..6d8ff11 100644 --- a/src/Application/UseCases/Campaign/Create/CreateCampaign.php +++ b/src/Application/UseCases/Campaign/Create/CreateCampaign.php @@ -5,8 +5,7 @@ declare(strict_types=1); namespace Application\UseCases\Campaign\Create; use Application\UseCases\Campaign\Create\Outputs\CampaignCreated; -use Application\UseCases\Campaign\Create\Outputs\CampaignCreationFailed; -use Application\UseCases\Campaign\Create\Outputs\CreateCampaignError; +use Application\UseCases\Campaign\Create\Outputs\CampaignNameAlreadyExists; use Domain\Models\Entities\Campaign; use Domain\Ports\Repositories\CampaignRepository; use Shared\DDD\UseCases\Input as BaseInput; @@ -29,7 +28,7 @@ final readonly class CreateCampaign implements UseCase, Transactional Assert::isInstanceOf($input, Input::class); if ($this->repository->existsByName($input->name)) { - return new CampaignCreationFailed(CreateCampaignError::CampaignNameAlreadyExists); + return new CampaignNameAlreadyExists(); } $campaign = Campaign::create( diff --git a/src/Application/UseCases/Campaign/Create/Outputs/CampaignCreationFailed.php b/src/Application/UseCases/Campaign/Create/Outputs/CampaignCreationFailed.php deleted file mode 100644 index bdb51f8..0000000 --- a/src/Application/UseCases/Campaign/Create/Outputs/CampaignCreationFailed.php +++ /dev/null @@ -1,15 +0,0 @@ - new Input(...array_merge([ @@ -72,7 +71,6 @@ describe('create campaign use case', function (): void { $result = $useCase->execute($input); // THEN - expect($result)->toBeInstanceOf(CampaignCreationFailed::class) - ->and($result->error)->toBe(CreateCampaignError::CampaignNameAlreadyExists); + expect($result)->toBeInstanceOf(CampaignNameAlreadyExists::class); }); });