From 0709d01240c609aea0bf1d43bd6bb902ca15bfec Mon Sep 17 00:00:00 2001 From: r-dev Date: Sun, 8 Mar 2026 13:39:44 +0100 Subject: [PATCH] chore(config) : add DAMA test bundle, update API Platform config, improve makefile - Register DAMADoctrineTestBundle for test env (transaction rollback) - Update API Platform title/description, add pagination defaults - Configure services for new controllers and commands - Update makefile targets Co-Authored-By: Claude Opus 4.6 --- composer.json | 4 +- composer.lock | 257 +++++++++++++++++++++++++++++- config/bundles.php | 2 + config/packages/api_platform.yaml | 5 +- config/reference.php | 25 ++- config/services.yaml | 5 + makefile | 6 +- symfony.lock | 9 ++ 8 files changed, 288 insertions(+), 25 deletions(-) diff --git a/composer.json b/composer.json index 0bb14a0..78bc599 100644 --- a/composer.json +++ b/composer.json @@ -86,9 +86,11 @@ } }, "require-dev": { + "dama/doctrine-test-bundle": "^8.6", "friendsofphp/php-cs-fixer": "^3.92", "phpunit/phpunit": "^12.5", "symfony/browser-kit": "8.0.*", - "symfony/css-selector": "8.0.*" + "symfony/css-selector": "8.0.*", + "symfony/http-client": "8.0.*" } } diff --git a/composer.lock b/composer.lock index 582ba11..5dbc6d5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9e0e35659f9b6ef5c0a60262a36b61f2", + "content-hash": "97c89001351c3dcf060e2b9b5f37a8a6", "packages": [ { "name": "api-platform/doctrine-common", @@ -7980,6 +7980,75 @@ ], "time": "2024-05-06T16:37:16+00:00" }, + { + "name": "dama/doctrine-test-bundle", + "version": "v8.6.0", + "source": { + "type": "git", + "url": "https://github.com/dmaicher/doctrine-test-bundle.git", + "reference": "f7e3487643e685432f7e27c50cac64e9f8c515a4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dmaicher/doctrine-test-bundle/zipball/f7e3487643e685432f7e27c50cac64e9f8c515a4", + "reference": "f7e3487643e685432f7e27c50cac64e9f8c515a4", + "shasum": "" + }, + "require": { + "doctrine/dbal": "^3.3 || ^4.0", + "doctrine/doctrine-bundle": "^2.11.0 || ^3.0", + "php": ">= 8.2", + "psr/cache": "^2.0 || ^3.0", + "symfony/cache": "^6.4 || ^7.3 || ^8.0", + "symfony/framework-bundle": "^6.4 || ^7.3 || ^8.0" + }, + "conflict": { + "phpunit/phpunit": "<11.0" + }, + "require-dev": { + "behat/behat": "^3.0", + "friendsofphp/php-cs-fixer": "^3.27", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^11.5.41|| ^12.3.14", + "symfony/dotenv": "^6.4 || ^7.3 || ^8.0", + "symfony/process": "^6.4 || ^7.3 || ^8.0" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "8.x-dev" + } + }, + "autoload": { + "psr-4": { + "DAMA\\DoctrineTestBundle\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "David Maicher", + "email": "mail@dmaicher.de" + } + ], + "description": "Symfony bundle to isolate doctrine database tests and improve test performance", + "keywords": [ + "doctrine", + "isolation", + "performance", + "symfony", + "testing", + "tests" + ], + "support": { + "issues": "https://github.com/dmaicher/doctrine-test-bundle/issues", + "source": "https://github.com/dmaicher/doctrine-test-bundle/tree/v8.6.0" + }, + "time": "2026-01-21T07:39:44+00:00" + }, { "name": "evenement/evenement", "version": "v3.0.2", @@ -10344,16 +10413,16 @@ }, { "name": "symfony/browser-kit", - "version": "v8.0.3", + "version": "v8.0.4", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "efc7cc6d442b80c8cb0ad0b29bdb0c9418cee9ee" + "reference": "0d998c101e1920fc68572209d1316fec0db728ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/efc7cc6d442b80c8cb0ad0b29bdb0c9418cee9ee", - "reference": "efc7cc6d442b80c8cb0ad0b29bdb0c9418cee9ee", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/0d998c101e1920fc68572209d1316fec0db728ef", + "reference": "0d998c101e1920fc68572209d1316fec0db728ef", "shasum": "" }, "require": { @@ -10392,7 +10461,7 @@ "description": "Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/browser-kit/tree/v8.0.3" + "source": "https://github.com/symfony/browser-kit/tree/v8.0.4" }, "funding": [ { @@ -10412,7 +10481,7 @@ "type": "tidelift" } ], - "time": "2025-12-16T08:10:18+00:00" + "time": "2026-01-13T13:06:50+00:00" }, { "name": "symfony/css-selector", @@ -10553,6 +10622,180 @@ ], "time": "2025-12-06T17:00:47+00:00" }, + { + "name": "symfony/http-client", + "version": "v8.0.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-client.git", + "reference": "ade9bd433450382f0af154661fc8e72758b4de36" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-client/zipball/ade9bd433450382f0af154661fc8e72758b4de36", + "reference": "ade9bd433450382f0af154661fc8e72758b4de36", + "shasum": "" + }, + "require": { + "php": ">=8.4", + "psr/log": "^1|^2|^3", + "symfony/http-client-contracts": "~3.4.4|^3.5.2", + "symfony/service-contracts": "^2.5|^3" + }, + "conflict": { + "amphp/amp": "<3", + "php-http/discovery": "<1.15" + }, + "provide": { + "php-http/async-client-implementation": "*", + "php-http/client-implementation": "*", + "psr/http-client-implementation": "1.0", + "symfony/http-client-implementation": "3.0" + }, + "require-dev": { + "amphp/http-client": "^5.3.2", + "amphp/http-tunnel": "^2.0", + "guzzlehttp/promises": "^1.4|^2.0", + "nyholm/psr7": "^1.0", + "php-http/httplug": "^1.0|^2.0", + "psr/http-client": "^1.0", + "symfony/cache": "^7.4|^8.0", + "symfony/dependency-injection": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/messenger": "^7.4|^8.0", + "symfony/process": "^7.4|^8.0", + "symfony/rate-limiter": "^7.4|^8.0", + "symfony/stopwatch": "^7.4|^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpClient\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously", + "homepage": "https://symfony.com", + "keywords": [ + "http" + ], + "support": { + "source": "https://github.com/symfony/http-client/tree/v8.0.7" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-03-06T13:17:40+00:00" + }, + { + "name": "symfony/http-client-contracts", + "version": "v3.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-client-contracts.git", + "reference": "75d7043853a42837e68111812f4d964b01e5101c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/75d7043853a42837e68111812f4d964b01e5101c", + "reference": "75d7043853a42837e68111812f4d964b01e5101c", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.6-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\HttpClient\\": "" + }, + "exclude-from-classmap": [ + "/Test/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to HTTP clients", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/http-client-contracts/tree/v3.6.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-04-29T11:18:49+00:00" + }, { "name": "symfony/options-resolver", "version": "v8.0.0", diff --git a/config/bundles.php b/config/bundles.php index 3b0483e..9155747 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -3,6 +3,7 @@ declare(strict_types=1); use ApiPlatform\Symfony\Bundle\ApiPlatformBundle; +use DAMA\DoctrineTestBundle\DAMADoctrineTestBundle; use Doctrine\Bundle\DoctrineBundle\DoctrineBundle; use Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle; use Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle; @@ -20,4 +21,5 @@ return [ NelmioCorsBundle::class => ['all' => true], ApiPlatformBundle::class => ['all' => true], LexikJWTAuthenticationBundle::class => ['all' => true], + DAMADoctrineTestBundle::class => ['test' => true], ]; diff --git a/config/packages/api_platform.yaml b/config/packages/api_platform.yaml index 6181ab1..058993f 100644 --- a/config/packages/api_platform.yaml +++ b/config/packages/api_platform.yaml @@ -1,5 +1,6 @@ api_platform: - title: Hello API Platform + title: Inventory API + description: API de gestion d'inventaire industriel — machines, pièces, composants, produits. version: 1.8.1 defaults: stateless: false @@ -7,3 +8,5 @@ api_platform: vary: ['Content-Type', 'Authorization', 'Origin'] pagination_items_per_page: 30 pagination_maximum_items_per_page: 200 + pagination_fetch_join_collection: true + pagination_partial: false diff --git a/config/reference.php b/config/reference.php index 36f4935..200e125 100644 --- a/config/reference.php +++ b/config/reference.php @@ -1,5 +1,7 @@ , + * } * @psalm-type ConfigType = array{ * imports?: ImportsConfig, * parameters?: ParametersConfig, @@ -1618,19 +1626,6 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param; * nelmio_cors?: NelmioCorsConfig, * api_platform?: ApiPlatformConfig, * lexik_jwt_authentication?: LexikJwtAuthenticationConfig, - * "when@dev"?: array{ - * imports?: ImportsConfig, - * parameters?: ParametersConfig, - * services?: ServicesConfig, - * framework?: FrameworkConfig, - * twig?: TwigConfig, - * security?: SecurityConfig, - * doctrine?: DoctrineConfig, - * doctrine_migrations?: DoctrineMigrationsConfig, - * nelmio_cors?: NelmioCorsConfig, - * api_platform?: ApiPlatformConfig, - * lexik_jwt_authentication?: LexikJwtAuthenticationConfig, - * }, * "when@prod"?: array{ * imports?: ImportsConfig, * parameters?: ParametersConfig, @@ -1656,6 +1651,7 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param; * nelmio_cors?: NelmioCorsConfig, * api_platform?: ApiPlatformConfig, * lexik_jwt_authentication?: LexikJwtAuthenticationConfig, + * dama_doctrine_test?: DamaDoctrineTestConfig, * }, * ..., * "when@prod"?: array, * "when@test"?: array, * ... diff --git a/config/services.yaml b/config/services.yaml index fe134d2..221c412 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -33,3 +33,8 @@ services: App\EventSubscriber\ComposantAuditSubscriber: tags: - { name: doctrine.event_subscriber } + + App\OpenApi\OpenApiDecorator: + decorates: 'api_platform.openapi.factory' + arguments: + $decorated: '@.inner' diff --git a/makefile b/makefile index f477b03..9299ade 100644 --- a/makefile +++ b/makefile @@ -37,7 +37,7 @@ start: env-init @echo "URLs disponibles:" @echo "- Symfony API: http://localhost:8081/api" @echo "- Nuxt (Inventory_frontend): http://localhost:3001" - @echo "- pgAdmin: http://localhost:5050" + @echo "- adminer: http://localhost:5050" # Éteint le container stop: @@ -117,6 +117,10 @@ php-cs-fixer-allow-risky: test: $(EXEC_PHP) php -d memory_limit="512M" vendor/bin/phpunit $(FILES) +test-setup: + $(SYMFONY_CONSOLE) doctrine:database:create --if-not-exists --env=test + $(SYMFONY_CONSOLE) doctrine:schema:update --force --env=test + wait: sleep 10 diff --git a/symfony.lock b/symfony.lock index 3a7ad08..b1f73d8 100644 --- a/symfony.lock +++ b/symfony.lock @@ -13,6 +13,15 @@ "src/ApiResource/.gitignore" ] }, + "dama/doctrine-test-bundle": { + "version": "8.6", + "recipe": { + "repo": "github.com/symfony/recipes-contrib", + "branch": "main", + "version": "8.3", + "ref": "dfc51177476fb39d014ed89944cde53dc3326d23" + } + }, "doctrine/deprecations": { "version": "1.1", "recipe": {