diff --git a/src/Carrier/UseCases/CreateCarrier.php b/src/Carrier/UseCases/CreateCarrier.php index b5c5724..c40a6d7 100644 --- a/src/Carrier/UseCases/CreateCarrier.php +++ b/src/Carrier/UseCases/CreateCarrier.php @@ -8,21 +8,20 @@ use FreightQuote\Carrier\CarrierRepository; class CreateCarrier { public function __construct( - private CreateCarrierRequest $dto, private CarrierRepository $carrierRepo, ) {} - public function execute(): Carrier + public function execute(CreateCarrierRequest $dto): Carrier { $carrier = new Carrier( null, - $this->dto->email, - $this->dto->companyName, - $this->dto->contactPerson, - $this->dto->phoneNumber, - $this->dto->notes, - $this->dto->loadProfile, - $this->dto->countriesServing, + $dto->email, + $dto->companyName, + $dto->contactPerson, + $dto->phoneNumber, + $dto->notes, + $dto->loadProfile, + $dto->countriesServing, [], ); diff --git a/tests/Unit/Carrier/UseCases/CreateCarrierTest.php b/tests/Unit/Carrier/UseCases/CreateCarrierTest.php index 8aaa4a3..34f8526 100644 --- a/tests/Unit/Carrier/UseCases/CreateCarrierTest.php +++ b/tests/Unit/Carrier/UseCases/CreateCarrierTest.php @@ -28,8 +28,8 @@ class CreateCarrierTest extends TestCase $loadProfile, $countriesServing, ); - $useCase = new CreateCarrier($dto, $carrierRepo); - $response = $useCase->execute(); + $useCase = new CreateCarrier($carrierRepo); + $response = $useCase->execute($dto); $foundCarrier = $carrierRepo->find($response->getId()); $this->assertEquals($email, $foundCarrier->getEmail()); $this->assertEquals($company, $foundCarrier->getCompanyName());