fix(logistique) : bloque la saisie manuelle poids/DSD à 5 chiffres
Pull Request — Quality gate / Backend (PHP CS + PHPUnit) (pull_request) Failing after 45s
Pull Request — Quality gate / Frontend (lint + Vitest + build) (pull_request) Successful in 51s

Masque front 5 chiffres sur la modale manuelle + Assert\LessThanOrEqual(99999)
sur WeighbridgeReadingResource (weight/dsd, mode MANUAL) et backstop entité
(validateManualEntryDigits). Le DSD auto (compteur de site) n'est pas contraint.
This commit is contained in:
2026-06-29 10:41:57 +02:00
parent b93737391d
commit 4ce1bafb2f
6 changed files with 95 additions and 6 deletions
@@ -133,6 +133,49 @@ final class WeighbridgeReadingApiTest extends AbstractApiTestCase
self::assertViolationOnPath($response, 'dsd');
}
public function testManualWeighingRejectsWeightOverFiveDigits(): void
{
$client = $this->manageClientWithCurrentSite();
$response = $client->request('POST', '/api/weighbridge_readings', [
'headers' => ['Content-Type' => 'application/ld+json'],
// 100000 = 6 chiffres → au-dela du plafond 5 chiffres (99999).
'json' => ['mode' => 'MANUAL', 'weight' => 100000, 'dsd' => 16619],
]);
self::assertResponseStatusCodeSame(422);
self::assertViolationOnPath($response, 'weight');
}
public function testManualWeighingRejectsDsdOverFiveDigits(): void
{
$client = $this->manageClientWithCurrentSite();
$response = $client->request('POST', '/api/weighbridge_readings', [
'headers' => ['Content-Type' => 'application/ld+json'],
'json' => ['mode' => 'MANUAL', 'weight' => 23187, 'dsd' => 100000],
]);
self::assertResponseStatusCodeSame(422);
self::assertViolationOnPath($response, 'dsd');
}
public function testManualWeighingAcceptsFiveDigitBoundary(): void
{
$client = $this->manageClientWithCurrentSite();
$response = $client->request('POST', '/api/weighbridge_readings', [
'headers' => ['Content-Type' => 'application/ld+json'],
// 99999 = exactement 5 chiffres → derniere valeur acceptee.
'json' => ['mode' => 'MANUAL', 'weight' => 99999, 'dsd' => 99999],
]);
self::assertResponseStatusCodeSame(200);
$data = $response->toArray();
self::assertSame(99999, $data['weight']);
self::assertSame(99999, $data['dsd']);
}
/**
* Garde-fou ERP-101 (miroir AbstractWeighingTicketApiTestCase) : une 422 doit
* porter une violation sur le `propertyPath` attendu, consommable inline par