fix(logistique) : bloque les caractères spéciaux dans le champ « Autre »
Pull Request — Quality gate / Backend (PHP CS + PHPUnit) (pull_request) Failing after 1m7s
Pull Request — Quality gate / Frontend (lint + Vitest + build) (pull_request) Successful in 1m36s

Assert\Regex(FREE_TEXT) sur otherLabel (miroir companyName/competitors) + masque
FREE_TEXT_MASK sur l'input « Autre » (new.vue / edit.vue).
This commit is contained in:
2026-06-29 10:52:02 +02:00
parent 4ce1bafb2f
commit 8a042fb578
4 changed files with 43 additions and 0 deletions
@@ -79,6 +79,43 @@ final class WeighingTicketLifecycleTest extends AbstractWeighingTicketApiTestCas
self::assertNull($body['counterpartyType'] ?? null);
}
public function testOtherLabelWithSpecialCharsIsRejected(): void
{
$http = $this->authManageOnSite($this->siteByCode('86'));
// Le back reste l'autorite (le masque front FREE_TEXT_MASK filtre deja a la
// frappe) : un libelle « Autre » avec des caracteres parasites -> 422 sur
// otherLabel (Assert\Regex FREE_TEXT), mappee inline cote front (ERP-101).
$response = $this->postTicket($http, [
'counterpartyType' => 'AUTRE',
'otherLabel' => 'Chantier ~#|<>{}',
'emptyDate' => '2026-06-17T09:00:00+02:00',
'emptyWeight' => 7150,
'emptyMode' => 'AUTO',
]);
self::assertResponseStatusCodeSame(422);
self::assertViolationOnPath($response, 'otherLabel');
}
public function testOtherLabelLegitimateIsAccepted(): void
{
$http = $this->authManageOnSite($this->siteByCode('86'));
// Lettres accentuees, chiffres, espaces, parentheses, °, & : tout autorise
// par FREE_TEXT (miroir des raisons sociales Client/Fournisseur).
$body = $this->postTicket($http, [
'counterpartyType' => 'AUTRE',
'otherLabel' => 'Chantier Léon (Pôle n°2) & Cie',
'emptyDate' => '2026-06-17T09:00:00+02:00',
'emptyWeight' => 7150,
'emptyMode' => 'AUTO',
])->toArray();
self::assertResponseStatusCodeSame(201);
self::assertSame('Chantier Léon (Pôle n°2) & Cie', $body['otherLabel']);
}
public function testValidateRequiresCounterparty(): void
{
$http = $this->authManageOnSite($this->siteByCode('86'));