fix(transport) : contact transporteur valide si prénom OU nom (alignement M1/M2/M3) (ERP-168)
Pull Request — Quality gate / Backend (PHP CS + PHPUnit) (pull_request) Successful in 3m24s
Pull Request — Quality gate / Frontend (lint + Vitest + build) (pull_request) Successful in 1m35s

This commit is contained in:
2026-06-17 09:47:11 +02:00
parent f27db02cb6
commit f29266e5e8
6 changed files with 80 additions and 37 deletions
@@ -15,8 +15,8 @@ use Symfony\Component\Console\Output\NullOutput;
* POST /api/carriers/{id}/contacts, PATCH/DELETE /api/carrier_contacts/{id}.
*
* Contrat verifie :
* - RG-4.08 : contact totalement vide -> 422 (au moins 1 champ requis) ;
* - RG-4.08 : 1 seul champ rempli -> 201 ;
* - RG-4.08 : contact sans prenom ni nom -> 422 (alignement M1/M2/M3) ;
* - RG-4.08 : un nom (ou prenom) suffit -> 201 ;
* - RG-4.08 : 3 telephones (tableau `phones`) -> 422 (max 2) ;
* - mapping `phones[]` -> phonePrimary / phoneSecondary + normalisation (RG-4.13) ;
* - PATCH / DELETE OK avec transport.carriers.manage, 403 sans (view seul).
@@ -51,7 +51,8 @@ final class CarrierContactApiTest extends AbstractCarrierApiTestCase
public function testEmptyContactReturns422(): void
{
// RG-4.08 : aucun champ rempli -> 422 (garde Processor, double du CHECK BDD).
// RG-4.08 (alignement M1/M2/M3) : sans prenom ni nom -> 422 (garde Processor,
// double du CHECK BDD chk_carrier_contact_name).
$carrier = $this->seedCarrier('Contact Vide');
$client = $this->createAdminClient();
@@ -60,13 +61,13 @@ final class CarrierContactApiTest extends AbstractCarrierApiTestCase
'json' => [],
]);
self::assertResponseStatusCodeSame(422);
// RG-4.08 : la violation est rattachee a `firstName` (mapping inline ERP-101).
// La violation est rattachee a `firstName` (mapping inline ERP-101).
self::assertViolationOnPath($response, 'firstName');
}
public function testSingleFieldContactIsCreated(): void
{
// RG-4.08 : un seul champ suffit a valider le bloc.
// RG-4.08 : un nom (ou prenom) suffit a valider le bloc.
$carrier = $this->seedCarrier('Contact Mono');
$client = $this->createAdminClient();