add load profile and countries serving to carrier

This commit is contained in:
Yisroel Baum 2025-11-11 20:43:18 +02:00
parent cce5e296c6
commit 3be8eee948
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
6 changed files with 37 additions and 0 deletions

View file

@ -11,6 +11,8 @@ class Carrier
private string $contactPerson, private string $contactPerson,
private string $phoneNumber, private string $phoneNumber,
private string $notes, private string $notes,
private string $loadProfile,
private array $countriesServing,
) {} ) {}
public function getId(): ?int public function getId(): ?int
@ -47,4 +49,14 @@ class Carrier
{ {
return $this->notes; return $this->notes;
} }
public function getLoadProfile(): string
{
return $this->loadProfile;
}
public function getCountriesServing(): array
{
return $this->countriesServing;
}
} }

View file

@ -21,6 +21,8 @@ class CreateCarrier
$this->dto->contactPerson, $this->dto->contactPerson,
$this->dto->phoneNumber, $this->dto->phoneNumber,
$this->dto->notes, $this->dto->notes,
$this->dto->loadProfile,
$this->dto->countriesServing,
); );
return $this->carrierRepo->save($carrier); return $this->carrierRepo->save($carrier);

View file

@ -10,5 +10,7 @@ class CreateCarrierRequest
public string $contactPerson, public string $contactPerson,
public string $phoneNumber, public string $phoneNumber,
public string $notes, public string $notes,
public string $loadProfile,
public array $countriesServing,
) {} ) {}
} }

View file

@ -7,6 +7,9 @@ use FreightQuote\Carrier\CarrierRepository;
class FakeCarrierRepository implements CarrierRepository class FakeCarrierRepository implements CarrierRepository
{ {
/**
* @var Carrier[]
*/
private array $existingCarriers = []; private array $existingCarriers = [];
public function find(int $id): ?Carrier public function find(int $id): ?Carrier
@ -20,6 +23,8 @@ class FakeCarrierRepository implements CarrierRepository
$carrier->getContactPerson(), $carrier->getContactPerson(),
$carrier->getPhoneNumber(), $carrier->getPhoneNumber(),
$carrier->getNotes(), $carrier->getNotes(),
$carrier->getLoadProfile(),
$carrier->getCountriesServing(),
); );
} }
} }
@ -43,6 +48,8 @@ class FakeCarrierRepository implements CarrierRepository
$carrier->getContactPerson(), $carrier->getContactPerson(),
$carrier->getPhoneNumber(), $carrier->getPhoneNumber(),
$carrier->getNotes(), $carrier->getNotes(),
$carrier->getLoadProfile(),
$carrier->getCountriesServing(),
); );
} }
@ -61,6 +68,8 @@ class FakeCarrierRepository implements CarrierRepository
$carrier->getContactPerson(), $carrier->getContactPerson(),
$carrier->getPhoneNumber(), $carrier->getPhoneNumber(),
$carrier->getNotes(), $carrier->getNotes(),
$carrier->getLoadProfile(),
$carrier->getCountriesServing(),
); );
}, $this->existingCarriers); }, $this->existingCarriers);
} }

View file

@ -16,6 +16,8 @@ class CreateCarrierTest extends TestCase
$contactPerson = 'Joe Shmoe'; $contactPerson = 'Joe Shmoe';
$phoneNumber = '132456798'; $phoneNumber = '132456798';
$notes = 'some notes'; $notes = 'some notes';
$loadProfile = 'LTL/FTL'; // Less than full trailer load and full trailer load
$countriesServing = ['USA', 'FRA', 'UK'];
$carrierRepo = new FakeCarrierRepository(); $carrierRepo = new FakeCarrierRepository();
$dto = new CreateCarrierRequest( $dto = new CreateCarrierRequest(
$email, $email,
@ -23,6 +25,8 @@ class CreateCarrierTest extends TestCase
$contactPerson, $contactPerson,
$phoneNumber, $phoneNumber,
$notes, $notes,
$loadProfile,
$countriesServing,
); );
$useCase = new CreateCarrier($dto, $carrierRepo); $useCase = new CreateCarrier($dto, $carrierRepo);
$response = $useCase->execute(); $response = $useCase->execute();
@ -32,5 +36,7 @@ class CreateCarrierTest extends TestCase
$this->assertEquals($contactPerson, $foundCarrier->getContactPerson()); $this->assertEquals($contactPerson, $foundCarrier->getContactPerson());
$this->assertEquals($phoneNumber, $foundCarrier->getPhoneNumber()); $this->assertEquals($phoneNumber, $foundCarrier->getPhoneNumber());
$this->assertEquals($notes, $foundCarrier->getNotes()); $this->assertEquals($notes, $foundCarrier->getNotes());
$this->assertEquals($loadProfile, $foundCarrier->getLoadProfile());
$this->assertEquals($countriesServing, $foundCarrier->getCountriesServing());
} }
} }

View file

@ -16,6 +16,8 @@ class GetAllCarriersTest extends TestCase
$contactPerson = 'joe shmoe'; $contactPerson = 'joe shmoe';
$phoneNumber = '123456798'; $phoneNumber = '123456798';
$notes = 'some notes'; $notes = 'some notes';
$loadProfile = 'LTL/FTL';
$countriesServing = ['USA', 'FRA', 'UK'];
$repo = new FakeCarrierRepository(); $repo = new FakeCarrierRepository();
$repo->save(new Carrier( $repo->save(new Carrier(
0, 0,
@ -24,6 +26,8 @@ class GetAllCarriersTest extends TestCase
$contactPerson, $contactPerson,
$phoneNumber, $phoneNumber,
$notes, $notes,
$loadProfile,
$countriesServing,
)); ));
$useCase = new GetAllCarriers($repo); $useCase = new GetAllCarriers($repo);
$response = $useCase->execute(); $response = $useCase->execute();
@ -35,6 +39,8 @@ class GetAllCarriersTest extends TestCase
$contactPerson, $contactPerson,
$phoneNumber, $phoneNumber,
$notes, $notes,
$loadProfile,
$countriesServing,
)], )],
$response $response
); );