[ERP-48] Écrire les tests PHPUnit RG-1.01 à RG-1.17 #20

Merged
malio merged 3 commits from feature/ERP-48-tests-phpunit-rg-1-01-a-1-17 into develop 2026-05-28 09:48:17 +00:00

3 Commits

Author SHA1 Message Date
Matthieu c777ca057b test(catalog) : cover RG-1.01 to RG-1.17 with 9 test classes (63 tests)
Pull Request — Quality gate / Backend (PHP CS + PHPUnit) (pull_request) Failing after 1m23s
Pull Request — Quality gate / Frontend (lint + Vitest + build) (pull_request) Successful in 1m6s
PHPUnit suite for the M0 Catalog module covering the 17 business rules of
the spec :
- CategoryPermissionsTest (RG-1.01) — 4 personas + admin + anonymous on GET / POST / PATCH / DELETE
- CategoryValidationTest (RG-1.02 to RG-1.06) — name NotBlank + trim + length + categoryType required / must exist
- CategoryUniqueTest (RG-1.07) — 409 case-insensitive, multi-type allowed, recreate after soft delete
- CategoryListTest (RG-1.08 to RG-1.10) — soft-delete filter, includeDeleted flag, name ASC sort
- CategoryGetTest (RG-1.11) — 404 on soft-deleted, 200 with flag, 404 on not found
- CategoryDeleteTest (RG-1.12 / RG-1.13) — soft delete, deletedAt unwriteable via PATCH, 404 on already deleted
- CategoryAuditTest — audit_log written on create / update / soft delete with correct performed_by
- CategoryTimestampableBlamableTest (RG-1.15 / RG-1.16) — blame admin on POST, null in console context, frozen createdBy on PATCH, updated_* on soft delete
- EntitiesAreTimestampableBlamableTest (RG-1.17) — stays green (already shipped in ERP-52)

Side fixes uncovered by the suite :
- Category.php : add normalizer 'trim' to NotBlank + Length so a whitespace-only
  name returns 422 (RG-1.02 + RG-1.03 alignment, the Processor trim was running
  after validation).
- makefile : recreate the partial index uq_category_name_type_active in
  test-db-setup. doctrine:schema:update drops the unexpressable index after
  migrations, which made RG-1.07 silently pass (duplicate POST -> 201 instead
  of 409). The DDL is now restored after schema:update via dbal:run-sql.

Tests : 311 total (248 + 63 new), 1071 assertions, 0 failure, 0 risky.
2026-05-28 11:48:02 +02:00
Matthieu ee291ebc2c ci : retire tout le caching (backend de cache runner injoignable, timeout 4m30)
Les logs montrent que chaque operation actions/cache attend ~4m30 avant
ETIMEDOUT sur le serveur de cache du runner Gitea (51.91.78.99:39531) :
- cache: npm de setup-node = tout le 'Setup Node 22' (271s)
- cache node_modules et cache .nuxt : timeouts additionnels
- cache Composer cote backend : meme risque

Node 22 est deja dans le tool-cache (install instantane), npm ci a froid
~30s, build ~20s : le caching n'apportait rien ici. A re-activer si le
serveur de cache du runner est repare.
2026-05-28 11:48:02 +02:00
Matthieu 1cdfe0cd9e ci(frontend) : accelere le job PR (nuxt build + cache node_modules & build Nuxt/Vite)
- remplace build:dist (nuxt generate + prerender inutile en SPA) par nuxt build
- cache node_modules sur hash du lockfile, npm ci uniquement en cache miss
- regenere les types Nuxt (postinstall) en cache hit
- cache des artefacts .nuxt / Vite avec restore-keys pour eviter le build a froid
2026-05-28 11:48:02 +02:00