test(transport) : rigueur RG sous-ressources (propertyPath, 404 parent, 401, certif)
Pull Request — Quality gate / Backend (PHP CS + PHPUnit) (pull_request) Failing after 54s
Pull Request — Quality gate / Frontend (lint + Vitest + build) (pull_request) Successful in 1m33s

Repond aux retours de review (rigueur d'assertion transversale) :
- mutualise assertViolationOnPath dans AbstractCarrierApiTestCase (au lieu d'un
  duplicata local a CarrierWriteApiTest) ;
- asserte le propertyPath des 422 des sous-ressources (adresses city/street/postalCode,
  contacts firstName/phones/email, prix clientDeliveryAddress/supplierSupplyAddress/price)
  -> evite les faux-verts du mapping inline (ERP-101) ;
- 404 parent (POST sur /carriers/999999/{addresses,contacts,prices}) ;
- 401 anonyme + filtre ?certificationType= sur la collection (trous releves sur le
  contrat de lecture).
This commit is contained in:
Matthieu
2026-06-16 14:57:45 +02:00
parent 18c88156e5
commit c1fcd9a7c8
6 changed files with 170 additions and 29 deletions
@@ -221,20 +221,4 @@ final class CarrierWriteApiTest extends AbstractCarrierApiTestCase
]);
self::assertResponseStatusCodeSame(422);
}
/**
* Verifie qu'une violation 422 cible bien la propriete attendue (propertyPath),
* gage du mapping inline front (useFormErrors, ERP-101).
*/
private function assertViolationOnPath(object $response, string $path): void
{
/** @var \Symfony\Contracts\HttpClient\ResponseInterface $response */
$paths = array_column($response->toArray(false)['violations'] ?? [], 'propertyPath');
self::assertContains(
$path,
$paths,
sprintf('Aucune violation sur "%s" (paths: %s).', $path, implode(', ', $paths)),
);
}
}