fix: rendre un animal adopté indisponible
This commit is contained in:
parent
d35434c522
commit
b8abaa8440
7 changed files with 42 additions and 9 deletions
|
|
@ -26,6 +26,9 @@ foreach (
|
|||
'CalendarFeedService',
|
||||
'NotificationService',
|
||||
'PrivacyService',
|
||||
'GeocodeService',
|
||||
'LocationHistoryService',
|
||||
'AdoptionService',
|
||||
'StatisticsService',
|
||||
'PricingService',
|
||||
'SpeciesService',
|
||||
|
|
@ -360,11 +363,23 @@ try {
|
|||
$db->prepare(
|
||||
"INSERT INTO medical_notes(animal_id,kind,reason,created_by) VALUES(?,'controle','Contrôle de test',?)",
|
||||
)->execute([$animal, Auth::id()]);
|
||||
$db->prepare(
|
||||
"INSERT INTO adoptions(animal_id,adopter_name,adoption_date) VALUES(?,'Adoptant test',date('now'))",
|
||||
)->execute([$animal]);
|
||||
AdoptionService::adopt([
|
||||
'animal_id' => $animal,
|
||||
'adopter_name' => 'Adoptant test',
|
||||
'adopter_phone' => '',
|
||||
'adopter_email' => '',
|
||||
'adopter_address' => '',
|
||||
'adopter_postal_code' => '',
|
||||
'adopter_city' => '',
|
||||
'adoption_date' => date('Y-m-d'),
|
||||
'notes' => '',
|
||||
'adopter_contact_id' => null,
|
||||
]);
|
||||
$assert((int) $db->query('SELECT COUNT(*) FROM medical_notes')->fetchColumn() === 1);
|
||||
$assert((int) $db->query('SELECT COUNT(*) FROM adoptions')->fetchColumn() === 1);
|
||||
$availability = $db->query("SELECT adoption_availability FROM animals WHERE internal_code='TEST-001'")
|
||||
->fetchColumn();
|
||||
$assert($availability === 'not_available', 'Un animal adopté reste disponible à l’adoption');
|
||||
$assert(!$db->query('PRAGMA foreign_key_check')->fetchAll());
|
||||
});
|
||||
$test('Les contrôles médicaux conservent leur date et leur heure', function () use ($assert): void {
|
||||
|
|
|
|||
Loading…
Reference in a new issue