Implemente le journal d'audit append-only sur toutes les mutations Doctrine des entites portant #[Auditable]. Couvre les 5 tickets de doc/audit-log.md : 1. Table PG audit_log (uuid PK, jsonb changes, index entity/time/performer) + AuditLogWriter (DBAL connexion dediee audit, blacklist defense-in-depth sur password/plainPassword/token/secret) + RequestIdProvider (UUID v4 par requete HTTP principale). 2. Attributs Auditable / AuditIgnore dans Shared/Domain/Attribute/ + AuditListener (onFlush capture + postFlush ecriture hors transaction ORM, pattern swap-and-clear, erreurs loguees jamais propagees). User annote. 3. API Platform read-only /api/audit-logs (permission core.audit_log.view) avec filtres entity_type / entity_id / action / performed_by / plage performed_at + DbalPaginator implementant PaginatorInterface (hydra:view genere automatiquement). 4. Page admin /admin/audit-log : tableau pagine, filtres persistes en query params, row expandable (diff + timeline de l'entite), entree sidebar avec permission. Composable useAuditLog avec resetAuditLog() auto-enregistre sur onAuthSessionCleared. 5. Composant AuditTimeline reutilisable : garde permission, lazy loading, dates relatives FR, skeleton loader. Fix connexe : phpunit.dist.xml forcait APP_ENV=dev via <env> ce qui cablait framework.test=false et rendait test.service_container indisponible ; le JWT_PASSPHRASE ne matchait pas non plus les cles dev. Corrige en meme temps pour debloquer la suite de tests.
86 lines
3.9 KiB
XML
86 lines
3.9 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
|
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
|
colors="true"
|
|
failOnDeprecation="true"
|
|
failOnNotice="true"
|
|
failOnWarning="true"
|
|
bootstrap="tests/bootstrap.php"
|
|
cacheDirectory=".phpunit.cache"
|
|
>
|
|
<php>
|
|
<ini name="display_errors" value="1" />
|
|
<ini name="error_reporting" value="-1" />
|
|
<server name="APP_ENV" value="test" force="true" />
|
|
<server name="SHELL_VERBOSITY" value="-1" />
|
|
<server name="KERNEL_CLASS" value="App\Kernel" />
|
|
|
|
<!-- ###+ symfony/framework-bundle ### -->
|
|
<!-- APP_ENV est force a "test" en <server> ci-dessus : on ne doit PAS
|
|
re-injecter "dev" ici via <env>, sinon la suite tourne sous
|
|
framework.test=false et `test.service_container` n'est pas cable
|
|
(cf. cc8d5 du fix pre-existant). -->
|
|
<env name="APP_ENV" value="test"/>
|
|
<env name="APP_SECRET" value=""/>
|
|
<env name="APP_SHARE_DIR" value="var/share"/>
|
|
<!-- ###- symfony/framework-bundle ### -->
|
|
|
|
<!-- ###+ symfony/routing ### -->
|
|
<!-- Configure how to generate URLs in non-HTTP contexts, such as CLI commands. -->
|
|
<!-- See https://symfony.com/doc/current/routing.html#generating-urls-in-commands -->
|
|
<env name="DEFAULT_URI" value="http://localhost"/>
|
|
<!-- ###- symfony/routing ### -->
|
|
|
|
<!-- ###+ doctrine/doctrine-bundle ### -->
|
|
<!-- Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url -->
|
|
<!-- IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml -->
|
|
<!-- -->
|
|
<!-- DATABASE_URL="sqlite:///%kernel.project_dir%/var/data_%kernel.environment%.db" -->
|
|
<!-- DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4" -->
|
|
<!-- DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4" -->
|
|
<env name="DATABASE_URL" value="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8"/>
|
|
<!-- ###- doctrine/doctrine-bundle ### -->
|
|
|
|
<!-- ###+ lexik/jwt-authentication-bundle ### -->
|
|
<env name="JWT_SECRET_KEY" value="%kernel.project_dir%/config/jwt/private.pem"/>
|
|
<env name="JWT_PUBLIC_KEY" value="%kernel.project_dir%/config/jwt/public.pem"/>
|
|
<!-- Doit correspondre a la passphrase utilisee lors de la generation
|
|
des cles JWT (config/jwt/*.pem). En local dev, c'est la valeur
|
|
par defaut "change_me_in_env_local" du .env (override possible
|
|
via .env.test.local si les cles ont ete regenerees autrement). -->
|
|
<env name="JWT_PASSPHRASE" value="change_me_in_env_local"/>
|
|
<!-- ###- lexik/jwt-authentication-bundle ### -->
|
|
|
|
<!-- ###+ nelmio/cors-bundle ### -->
|
|
<env name="CORS_ALLOW_ORIGIN" value="'^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'"/>
|
|
<!-- ###- nelmio/cors-bundle ### -->
|
|
</php>
|
|
|
|
<testsuites>
|
|
<testsuite name="Project Test Suite">
|
|
<directory>tests</directory>
|
|
</testsuite>
|
|
</testsuites>
|
|
|
|
<source ignoreSuppressionOfDeprecations="true"
|
|
ignoreIndirectDeprecations="true"
|
|
restrictNotices="true"
|
|
restrictWarnings="true"
|
|
>
|
|
<include>
|
|
<directory>src</directory>
|
|
</include>
|
|
|
|
<deprecationTrigger>
|
|
<method>Doctrine\Deprecations\Deprecation::trigger</method>
|
|
<method>Doctrine\Deprecations\Deprecation::delegateTriggerToBackend</method>
|
|
<function>trigger_deprecation</function>
|
|
</deprecationTrigger>
|
|
</source>
|
|
|
|
<extensions>
|
|
</extensions>
|
|
</phpunit>
|