move dto from constructor to method paramour
in create carrier use case
This commit is contained in:
parent
18e43b3bac
commit
908baee2a7
2 changed files with 10 additions and 11 deletions
|
|
@ -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,
|
||||
[],
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue