chore(dev): DDEV setup so the test suite actually runs
CI / test (push) Has been cancelled

Mirrors aqua-iq's pattern but adapted for pictureFrame's stack:
postgres 16, php 8.4, node 22, imagick + pcov via apt extras,
Mercure hub at https://pictureframe.ddev.site/.well-known/mercure,
and four custom commands — `ddev tests`, `ddev coverage`,
`ddev frontend` (vite HMR), `ddev worker`.

Also restores dev deps (DAMA, Doctrine fixtures, symfony/uid) that
got dropped during earlier composer reshuffles, and adds a separate
`db_test` connection in .env.test so DAMA's transactional isolation
doesn't share state with whatever dev is mid-experiment with.

Two test fixes the new env exposed:
  - RotationServiceTest::test_prioritize_never_shown_falls_through_when_all_shown
    needed uniquenessWindow=2 so the recent-window filter wipes the
    set and the fallback restores the full pool — otherwise window=1
    excluded the most-recently-served image and the assertion drifted.
  - DeviceImageControllerTest::test_locked_image_served_without_rotation_advance
    was asserting currentImage stays null on a lock poll, but the
    controller intentionally sets currentImage on the lock path so
    Home reflects the live frame state. Now asserts both the
    currentImage update AND that no DeviceImageHistory row was
    written (the actual rotation-bypass guarantee).

Backend coverage (full suite via `ddev coverage`): 89.08% lines /
92.24% methods / 74.36% classes — the first real number we've had.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-08 13:56:36 -04:00
parent b48ed73b4e
commit 2a8bf3895f
14 changed files with 602 additions and 13 deletions
+6
View File
@@ -0,0 +1,6 @@
#!/bin/bash
## Description: Run PHPUnit with text coverage summary (pcov)
## Usage: coverage
## Example: ddev coverage
APP_ENV=test bin/phpunit --coverage-text
+10
View File
@@ -0,0 +1,10 @@
#!/bin/bash
## Description: Run vite dev server (HMR for the SPA)
## Usage: frontend
## Example: ddev frontend
##
## Connect via the URL DDEV prints once vite is up — usually
## https://pictureframe.ddev.site:<port>. For a one-shot prod build
## (writes public/build/), run `ddev exec "cd frontend && npm run build"`.
cd frontend && npm run dev -- --host 0.0.0.0
+18
View File
@@ -0,0 +1,18 @@
#!/bin/bash
## Description: Run the full test suite — PHPUnit + vitest + vue-tsc
## Usage: tests [phpunit-args]
## Example: ddev tests
## Example: ddev tests --filter test_id_tz_01
set -euo pipefail
echo "── PHP unit + integration ─────────────────────────────"
# DDEV's web_environment sets APP_ENV=dev for dev work — phpunit's xml <server>
# directive doesn't always override that cleanly, so force the env explicitly.
APP_ENV=test bin/phpunit "$@"
echo
echo "── Frontend typecheck + tests ─────────────────────────"
cd frontend
npx vue-tsc --noEmit -p tsconfig.app.json
npx vitest run
+6
View File
@@ -0,0 +1,6 @@
#!/bin/bash
## Description: Run the Symfony Messenger worker (foreground)
## Usage: worker
## Example: ddev worker
php bin/console messenger:consume async image_processing scheduler_default --time-limit=0 -vv