feat(admin): humanise les libelles restants (Reference, Variation, Auteur)
Some checks failed
CI / secret-scan (push) Successful in 9s
CI / php-lint (push) Successful in 27s
CI / static-tests (push) Successful in 51s
CI / js-tests (push) Successful in 28s
CI / secret-scan (pull_request) Successful in 9s
CI / static-tests (pull_request) Successful in 46s
CI / php-lint (pull_request) Successful in 23s
CI / js-tests (pull_request) Successful in 30s
CI / auto-merge (push) Has been skipped
CI / auto-merge (pull_request) Failing after 12s
Some checks failed
CI / secret-scan (push) Successful in 9s
CI / php-lint (push) Successful in 27s
CI / static-tests (push) Successful in 51s
CI / js-tests (push) Successful in 28s
CI / secret-scan (pull_request) Successful in 9s
CI / static-tests (pull_request) Successful in 46s
CI / php-lint (pull_request) Successful in 23s
CI / js-tests (pull_request) Successful in 30s
CI / auto-merge (push) Has been skipped
CI / auto-merge (pull_request) Failing after 12s
- Categories : 'Slug' -> 'Reference' (en-tete liste + label form + 3 messages de validation alignes dans CategoryController). - Mouvements de stock : 'Delta' -> 'Variation', 'Acteur' -> 'Auteur'. Tests CategoryController/IngredientController mis a jour. PHPUnit 301 + PHPStan L6 verts.
This commit is contained in:
parent
60535bbe00
commit
21e2c83fda
6 changed files with 11 additions and 11 deletions
|
|
@ -197,9 +197,9 @@ class CategoryController extends AdminController
|
|||
}
|
||||
|
||||
if ($slug === '' || mb_strlen($slug) > 60 || preg_match('/^[a-z0-9]+(?:-[a-z0-9]+)*$/', $slug) !== 1) {
|
||||
$errors['slug'] = 'Slug requis : minuscules, chiffres et tirets (60 max).';
|
||||
$errors['slug'] = 'Reference requise : minuscules, chiffres et tirets (60 max).';
|
||||
} elseif ($repo->slugExists($slug, $exceptId)) {
|
||||
$errors['slug'] = 'Ce slug existe deja.';
|
||||
$errors['slug'] = 'Cette reference existe deja.';
|
||||
}
|
||||
|
||||
if ($image !== '' && mb_strlen($image) > 255) {
|
||||
|
|
@ -258,7 +258,7 @@ class CategoryController extends AdminController
|
|||
// getCode() rend la chaine SQLSTATE pour une vraie PDOException ; le cast
|
||||
// couvre aussi un code entier (23000 = violation de contrainte d'integrite).
|
||||
if ((string) $exception->getCode() === '23000') {
|
||||
return $this->renderForm($guard, $id, $form, ['slug' => 'Ce libelle ou ce slug existe deja.'], 409);
|
||||
return $this->renderForm($guard, $id, $form, ['slug' => 'Ce libelle ou cette reference existe deja.'], 409);
|
||||
}
|
||||
|
||||
throw $exception;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ $err = static fn (string $k): string => isset($errs[$k]) && is_string($errs[$k])
|
|||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="slug">Slug</label>
|
||||
<label class="form-label" for="slug">Reference</label>
|
||||
<input class="form-input" type="text" id="slug" name="slug" maxlength="60" value="<?= $val('slug') ?>" required>
|
||||
<?php if ($err('slug') !== ''): ?><p class="form-error"><?= htmlspecialchars($err('slug'), ENT_QUOTES, 'UTF-8') ?></p><?php endif; ?>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ $esc = static fn (mixed $v): string => htmlspecialchars((string) $v, ENT_QUOTES,
|
|||
<thead>
|
||||
<tr>
|
||||
<th>Libelle</th>
|
||||
<th>Slug</th>
|
||||
<th>Reference</th>
|
||||
<th>Ordre</th>
|
||||
<th>Statut</th>
|
||||
<th style="width:160px;"></th>
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ $colspan = $withActor ? 5 : 4;
|
|||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Type</th>
|
||||
<th>Delta</th>
|
||||
<th>Variation</th>
|
||||
<th>Note</th>
|
||||
<?php if ($withActor): ?><th>Acteur</th><?php endif; ?>
|
||||
<?php if ($withActor): ?><th>Auteur</th><?php endif; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ final class CategoryControllerTest extends TestCase
|
|||
|
||||
self::assertSame(422, $response->status());
|
||||
self::assertStringContainsString('Le libelle est requis', $response->body());
|
||||
self::assertStringContainsString('Slug requis', $response->body());
|
||||
self::assertStringContainsString('Reference requise', $response->body());
|
||||
self::assertFalse($this->wroteContaining($db, 'INSERT INTO category'));
|
||||
}
|
||||
|
||||
|
|
@ -266,7 +266,7 @@ final class CategoryControllerTest extends TestCase
|
|||
$response = $this->controller($request, $db)->store();
|
||||
|
||||
self::assertSame(422, $response->status());
|
||||
self::assertStringContainsString('Ce slug existe deja', $response->body());
|
||||
self::assertStringContainsString('Cette reference existe deja', $response->body());
|
||||
self::assertFalse($this->wroteContaining($db, 'INSERT INTO category'));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -425,7 +425,7 @@ final class IngredientControllerTest extends TestCase
|
|||
$response = $this->controller($this->get('/admin/ingredients/5/movements'), $db)->movements(['id' => '5']);
|
||||
|
||||
self::assertSame(200, $response->status());
|
||||
self::assertStringContainsString('Acteur', $response->body());
|
||||
self::assertStringContainsString('Auteur', $response->body());
|
||||
self::assertStringContainsString('Sam K', $response->body()); // nom resolu
|
||||
}
|
||||
|
||||
|
|
@ -438,6 +438,6 @@ final class IngredientControllerTest extends TestCase
|
|||
$response = $this->controller($this->get('/admin/ingredients/5/movements'), $db)->movements(['id' => '5']);
|
||||
|
||||
self::assertSame(200, $response->status());
|
||||
self::assertStringNotContainsString('Acteur', $response->body()); // colonne masquee (RG-4)
|
||||
self::assertStringNotContainsString('Auteur', $response->body()); // colonne masquee (RG-4)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue