fix(logistique) : bloque la saisie manuelle poids/DSD à 5 chiffres
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user