test that carrier email is unique

This commit is contained in:
Yisroel Baum 2025-11-18 09:22:13 +02:00
parent 908baee2a7
commit 2d8bca1a07
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
4 changed files with 60 additions and 0 deletions

View file

@ -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;
}
}