#!/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
