test that carrier email is unique
This commit is contained in:
parent
908baee2a7
commit
2d8bca1a07
4 changed files with 60 additions and 0 deletions
|
|
@ -73,4 +73,24 @@ class FakeCarrierRepository implements CarrierRepository
|
|||
);
|
||||
}, $this->existingCarriers);
|
||||
}
|
||||
|
||||
public function findByEmail(string $email): ?Carrier
|
||||
{
|
||||
foreach ($this->existingCarriers as $carrier) {
|
||||
if ($carrier->getEmail() === $email) {
|
||||
return new Carrier(
|
||||
$carrier->getId(),
|
||||
$email,
|
||||
$carrier->getCompanyName(),
|
||||
$carrier->getContactPerson(),
|
||||
$carrier->getPhoneNumber(),
|
||||
$carrier->getNotes(),
|
||||
$carrier->getLoadProfile(),
|
||||
$carrier->getCountriesServing(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue