fix(transport) : onglet Contact transporteur non obligatoire + navigation onglets (ERP-193)
- retrait de la regle « prenom OU nom » sur le bloc Contact : garde CarrierContactProcessor::validateName supprimee, CHECK chk_carrier_contact_name droppe (migration Version20260619120000), commentaires SQL/catalogue alignes - front : gating « + Nouveau contact » sur bloc non vide (au lieu de « nomme »), onglet Contact vide finalisable sans creer de contact - Prix accessible des la validation des Adresses (Contacts optionnel ne bloque plus) - consultation <-> edition : on retombe sur le meme onglet via ?tab=
This commit is contained in:
@@ -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 sans prenom ni nom -> 422 (alignement M1/M2/M3) ;
|
||||
* - RG-4.08 : un nom (ou prenom) suffit -> 201 ;
|
||||
* - ERP-193 : contact sans prenom ni nom -> 201 (bloc Contact optionnel) ;
|
||||
* - un nom (ou prenom) seul 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).
|
||||
@@ -49,25 +49,25 @@ final class CarrierContactApiTest extends AbstractCarrierApiTestCase
|
||||
self::ensureKernelShutdown();
|
||||
}
|
||||
|
||||
public function testEmptyContactReturns422(): void
|
||||
public function testContactWithoutNameIsCreated(): void
|
||||
{
|
||||
// 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');
|
||||
// ERP-193 (retour metier) : l'onglet Contact n'est plus obligatoire et la
|
||||
// garde « prenom OU nom » (ex RG-4.08) est retiree -> un contact sans nom
|
||||
// (ici un simple telephone) est desormais accepte (201).
|
||||
$carrier = $this->seedCarrier('Contact Sans Nom');
|
||||
$client = $this->createAdminClient();
|
||||
|
||||
$response = $client->request('POST', '/api/carriers/'.$carrier->getId().'/contacts', [
|
||||
$client->request('POST', '/api/carriers/'.$carrier->getId().'/contacts', [
|
||||
'headers' => ['Content-Type' => self::LD],
|
||||
'json' => [],
|
||||
'json' => ['phones' => ['0611111111']],
|
||||
]);
|
||||
self::assertResponseStatusCodeSame(422);
|
||||
// La violation est rattachee a `firstName` (mapping inline ERP-101).
|
||||
self::assertViolationOnPath($response, 'firstName');
|
||||
self::assertResponseStatusCodeSame(201);
|
||||
self::assertJsonContains(['phonePrimary' => '0611111111']);
|
||||
}
|
||||
|
||||
public function testSingleFieldContactIsCreated(): void
|
||||
{
|
||||
// RG-4.08 : un nom (ou prenom) suffit a valider le bloc.
|
||||
// Un nom (ou prenom) seul suffit a creer un contact.
|
||||
$carrier = $this->seedCarrier('Contact Mono');
|
||||
$client = $this->createAdminClient();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user