From e8c076a215a1e18f97299726fca80493593c0d9c Mon Sep 17 00:00:00 2001 From: Odin Date: Thu, 25 Jun 2026 20:46:35 +0200 Subject: [PATCH 01/11] test(doctrine-retry-bundle): AJDA-2222 load test env via dotenv and document setup --- libs/doctrine-retry-bundle/README.md | 15 +++++++++++++- libs/doctrine-retry-bundle/composer.json | 3 ++- .../doctrine-retry-bundle/tests/bootstrap.php | 20 ++++++++++++++++++- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/libs/doctrine-retry-bundle/README.md b/libs/doctrine-retry-bundle/README.md index 26cbfa8eb..dee0a91c0 100644 --- a/libs/doctrine-retry-bundle/README.md +++ b/libs/doctrine-retry-bundle/README.md @@ -16,6 +16,19 @@ doctrine: ``` ## Environment +The tests connect to MySQL through a [Toxiproxy](https://github.com/Shopify/toxiproxy) instance +(used to simulate connection failures). Both are provided by the `dev-doctrine-retry-bundle` +Docker Compose service, so the simplest way to run them is: +```bash +docker compose run --rm dev-doctrine-retry-bundle composer ci +``` + +The following variables are required: ``` -TEST_DATABASE_URL - database connection URL (mysql://user:secret@localhost/mydb) +TEST_DATABASE_HOST - MySQL host (e.g. mysql) +TEST_DATABASE_PORT - MySQL port (e.g. 3306) +TEST_DATABASE_USER - MySQL user (e.g. root) +TEST_DATABASE_PASSWORD - MySQL password +TEST_DATABASE_DB - MySQL database name (e.g. testdatabase) +TEST_PROXY_HOST - Toxiproxy host (e.g. toxiproxy); its API is reached at http://:8474 ``` diff --git a/libs/doctrine-retry-bundle/composer.json b/libs/doctrine-retry-bundle/composer.json index aa913dad7..de98133dc 100644 --- a/libs/doctrine-retry-bundle/composer.json +++ b/libs/doctrine-retry-bundle/composer.json @@ -24,7 +24,8 @@ "monolog/monolog": "^3.9", "phpstan/phpstan": "^2.1", "phpstan/phpstan-phpunit": "^2.0", - "phpunit/phpunit": "^12.1" + "phpunit/phpunit": "^12.1", + "symfony/dotenv": "^6.0|^7.0" }, "autoload": { "psr-4": { diff --git a/libs/doctrine-retry-bundle/tests/bootstrap.php b/libs/doctrine-retry-bundle/tests/bootstrap.php index a075e1e88..4b8891de6 100644 --- a/libs/doctrine-retry-bundle/tests/bootstrap.php +++ b/libs/doctrine-retry-bundle/tests/bootstrap.php @@ -2,4 +2,22 @@ declare(strict_types=1); -require_once __DIR__ . '/../vendor/autoload.php'; +use Symfony\Component\Dotenv\Dotenv; + +require __DIR__ . '/../vendor/autoload.php'; + +(new Dotenv())->usePutenv()->bootEnv(dirname(__DIR__).'/.env', 'dev', []); + +$requiredEnvs = [ + 'TEST_DATABASE_HOST', + 'TEST_DATABASE_PORT', + 'TEST_DATABASE_USER', + 'TEST_DATABASE_PASSWORD', + 'TEST_DATABASE_DB', + 'TEST_PROXY_HOST', +]; +foreach ($requiredEnvs as $env) { + if (empty(getenv($env))) { + throw new Exception(sprintf('Environment variable "%s" is empty', $env)); + } +} From 0af498a1a275e05fb35025a70a4bd1d8c6f2c54f Mon Sep 17 00:00:00 2001 From: Odin Date: Thu, 25 Jun 2026 23:01:45 +0200 Subject: [PATCH 02/11] fix(doctrine-retry-bundle): AJDA-2222 only load .env.local when present --- libs/doctrine-retry-bundle/tests/bootstrap.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/doctrine-retry-bundle/tests/bootstrap.php b/libs/doctrine-retry-bundle/tests/bootstrap.php index 4b8891de6..1949c8aeb 100644 --- a/libs/doctrine-retry-bundle/tests/bootstrap.php +++ b/libs/doctrine-retry-bundle/tests/bootstrap.php @@ -6,7 +6,9 @@ require __DIR__ . '/../vendor/autoload.php'; -(new Dotenv())->usePutenv()->bootEnv(dirname(__DIR__).'/.env', 'dev', []); +if (file_exists(dirname(__DIR__).'/.env.local')) { + (new Dotenv())->usePutenv()->bootEnv(dirname(__DIR__).'/.env.local', 'dev', []); +} $requiredEnvs = [ 'TEST_DATABASE_HOST', From f1162b2db1703116bc25be0f76703e7b2f708fd8 Mon Sep 17 00:00:00 2001 From: Odin Date: Sat, 27 Jun 2026 11:09:01 +0200 Subject: [PATCH 03/11] chore: rename phpstan.neon to phpstan.neon.dist --- libs/doctrine-retry-bundle/{phpstan.neon => phpstan.neon.dist} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename libs/doctrine-retry-bundle/{phpstan.neon => phpstan.neon.dist} (100%) diff --git a/libs/doctrine-retry-bundle/phpstan.neon b/libs/doctrine-retry-bundle/phpstan.neon.dist similarity index 100% rename from libs/doctrine-retry-bundle/phpstan.neon rename to libs/doctrine-retry-bundle/phpstan.neon.dist From 2a4f64f0665d32dde4e8a05b3c1b04717b1bff31 Mon Sep 17 00:00:00 2001 From: Odin Date: Sat, 27 Jun 2026 11:11:18 +0200 Subject: [PATCH 04/11] chore: upgrade keboola/coding-standard --- libs/doctrine-retry-bundle/composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/doctrine-retry-bundle/composer.json b/libs/doctrine-retry-bundle/composer.json index de98133dc..5128f0070 100644 --- a/libs/doctrine-retry-bundle/composer.json +++ b/libs/doctrine-retry-bundle/composer.json @@ -20,7 +20,7 @@ "require-dev": { "ext-pdo": "*", "ihsw/toxiproxy-php-client": "^3.0", - "keboola/coding-standard": "^15.1", + "keboola/coding-standard": "^16.0", "monolog/monolog": "^3.9", "phpstan/phpstan": "^2.1", "phpstan/phpstan-phpunit": "^2.0", @@ -47,8 +47,8 @@ "scripts": { "phpunit": "phpunit", "phpstan": "phpstan analyse", - "phpcs": "phpcs -n --ignore=vendor --extensions=php .", - "phpcbf": "phpcbf -n --ignore=vendor --extensions=php .", + "phpcs": "phpcs --extensions=php src tests", + "phpcbf": "phpcbf --extensions=php src tests", "build": [ "@composer validate --no-check-publish --no-check-all", "@phpcs", From e9abed671b3a351c2428158d2ce8d73990860f56 Mon Sep 17 00:00:00 2001 From: Odin Date: Sat, 27 Jun 2026 11:11:43 +0200 Subject: [PATCH 05/11] chore: upgrade PHPStan --- libs/doctrine-retry-bundle/composer.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/doctrine-retry-bundle/composer.json b/libs/doctrine-retry-bundle/composer.json index 5128f0070..334665125 100644 --- a/libs/doctrine-retry-bundle/composer.json +++ b/libs/doctrine-retry-bundle/composer.json @@ -25,7 +25,9 @@ "phpstan/phpstan": "^2.1", "phpstan/phpstan-phpunit": "^2.0", "phpunit/phpunit": "^12.1", - "symfony/dotenv": "^6.0|^7.0" + "symfony/dotenv": "^6.0|^7.0", + "phpstan/phpstan-symfony": "^2.0", + "phpstan/phpstan-doctrine": "^2.0" }, "autoload": { "psr-4": { @@ -46,7 +48,7 @@ }, "scripts": { "phpunit": "phpunit", - "phpstan": "phpstan analyse", + "phpstan": "phpstan analyse --no-progress", "phpcs": "phpcs --extensions=php src tests", "phpcbf": "phpcbf --extensions=php src tests", "build": [ From 8806e046edf5e786974294aeab83463849c5005b Mon Sep 17 00:00:00 2001 From: Odin Date: Sat, 27 Jun 2026 11:12:33 +0200 Subject: [PATCH 06/11] chore: complete Rector pass --- libs/doctrine-retry-bundle/composer.json | 7 ++++--- libs/doctrine-retry-bundle/phpstan.neon.dist | 17 ++++++++++------- .../src/Database/Retry/Driver.php | 3 ++- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/libs/doctrine-retry-bundle/composer.json b/libs/doctrine-retry-bundle/composer.json index 334665125..4770fee04 100644 --- a/libs/doctrine-retry-bundle/composer.json +++ b/libs/doctrine-retry-bundle/composer.json @@ -23,11 +23,12 @@ "keboola/coding-standard": "^16.0", "monolog/monolog": "^3.9", "phpstan/phpstan": "^2.1", + "phpstan/phpstan-doctrine": "^2.0", "phpstan/phpstan-phpunit": "^2.0", - "phpunit/phpunit": "^12.1", - "symfony/dotenv": "^6.0|^7.0", "phpstan/phpstan-symfony": "^2.0", - "phpstan/phpstan-doctrine": "^2.0" + "phpunit/phpunit": "^12.1", + "rector/rector": "^2.0", + "symfony/dotenv": "^6.0|^7.0" }, "autoload": { "psr-4": { diff --git a/libs/doctrine-retry-bundle/phpstan.neon.dist b/libs/doctrine-retry-bundle/phpstan.neon.dist index 4026fdc49..78b8fc08e 100644 --- a/libs/doctrine-retry-bundle/phpstan.neon.dist +++ b/libs/doctrine-retry-bundle/phpstan.neon.dist @@ -1,10 +1,13 @@ parameters: - level: max - paths: - - src - - tests - ignoreErrors: - - identifier: missingType.iterableValue + level: max + paths: + - src + - tests + + ignoreErrors: + - + identifier: missingType.iterableValue includes: - - vendor/phpstan/phpstan-phpunit/extension.neon + - vendor/phpstan/phpstan-phpunit/extension.neon + diff --git a/libs/doctrine-retry-bundle/src/Database/Retry/Driver.php b/libs/doctrine-retry-bundle/src/Database/Retry/Driver.php index 340462fbf..81d5b5b18 100644 --- a/libs/doctrine-retry-bundle/src/Database/Retry/Driver.php +++ b/libs/doctrine-retry-bundle/src/Database/Retry/Driver.php @@ -4,6 +4,7 @@ namespace Keboola\DoctrineRetryBundle\Database\Retry; +use Doctrine\DBAL\Driver\Connection; use Doctrine\DBAL\Driver as DriverInterface; use Doctrine\DBAL\Driver\Middleware\AbstractDriverMiddleware; use Retry\RetryProxyInterface; @@ -28,7 +29,7 @@ public function __construct(DriverInterface $driver, RetryProxyInterface $retryP public function connect(array $params): DriverInterface\Connection { /** @var DriverInterface\Connection $result */ - $result = $this->retryProxy->call(fn() => parent::connect($params)); + $result = $this->retryProxy->call(fn(): Connection => parent::connect($params)); return $result; } } From c55d06dfbcf90ff7210a31597eb3ca78e58a894c Mon Sep 17 00:00:00 2001 From: Odin Date: Sat, 27 Jun 2026 11:12:40 +0200 Subject: [PATCH 07/11] chore: upgrade Keboola Coding Standard --- libs/doctrine-retry-bundle/src/Database/Retry/Driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/doctrine-retry-bundle/src/Database/Retry/Driver.php b/libs/doctrine-retry-bundle/src/Database/Retry/Driver.php index 81d5b5b18..d3ce50f89 100644 --- a/libs/doctrine-retry-bundle/src/Database/Retry/Driver.php +++ b/libs/doctrine-retry-bundle/src/Database/Retry/Driver.php @@ -4,8 +4,8 @@ namespace Keboola\DoctrineRetryBundle\Database\Retry; -use Doctrine\DBAL\Driver\Connection; use Doctrine\DBAL\Driver as DriverInterface; +use Doctrine\DBAL\Driver\Connection; use Doctrine\DBAL\Driver\Middleware\AbstractDriverMiddleware; use Retry\RetryProxyInterface; From e931640176c05e102f592d617aebc73156523e73 Mon Sep 17 00:00:00 2001 From: Odin Date: Sat, 27 Jun 2026 11:14:14 +0200 Subject: [PATCH 08/11] chore: upgrade PHPUnit --- libs/doctrine-retry-bundle/composer.json | 4 ++-- libs/doctrine-retry-bundle/phpunit.xml.dist | 16 +++++----------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/libs/doctrine-retry-bundle/composer.json b/libs/doctrine-retry-bundle/composer.json index 4770fee04..594a67a3f 100644 --- a/libs/doctrine-retry-bundle/composer.json +++ b/libs/doctrine-retry-bundle/composer.json @@ -26,8 +26,8 @@ "phpstan/phpstan-doctrine": "^2.0", "phpstan/phpstan-phpunit": "^2.0", "phpstan/phpstan-symfony": "^2.0", - "phpunit/phpunit": "^12.1", - "rector/rector": "^2.0", + "phpunit/phpunit": "^13.0", + "rector/rector": "^1.2 || ^2.0", "symfony/dotenv": "^6.0|^7.0" }, "autoload": { diff --git a/libs/doctrine-retry-bundle/phpunit.xml.dist b/libs/doctrine-retry-bundle/phpunit.xml.dist index afb7d940e..5d5e806fe 100644 --- a/libs/doctrine-retry-bundle/phpunit.xml.dist +++ b/libs/doctrine-retry-bundle/phpunit.xml.dist @@ -1,21 +1,15 @@ - - + bootstrap="tests/bootstrap.php"> + src - - + From cb34e2c7985b80ccb843016eac39e5d445c311ea Mon Sep 17 00:00:00 2001 From: Odin Date: Sat, 27 Jun 2026 11:16:43 +0200 Subject: [PATCH 09/11] chore: upgrade symfony to ^8.0 --- libs/doctrine-retry-bundle/composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/doctrine-retry-bundle/composer.json b/libs/doctrine-retry-bundle/composer.json index 594a67a3f..80cc68f15 100644 --- a/libs/doctrine-retry-bundle/composer.json +++ b/libs/doctrine-retry-bundle/composer.json @@ -14,8 +14,8 @@ "doctrine/dbal": "^4.2", "doctrine/doctrine-bundle": "^2.1", "keboola/retry": "^0.5.0", - "symfony/dependency-injection": "^7.0|^6.4", - "symfony/http-kernel": "^7.0|^6.4" + "symfony/dependency-injection": "^8.0|^7.4", + "symfony/http-kernel": "^8.0|^7.4" }, "require-dev": { "ext-pdo": "*", @@ -28,7 +28,7 @@ "phpstan/phpstan-symfony": "^2.0", "phpunit/phpunit": "^13.0", "rector/rector": "^1.2 || ^2.0", - "symfony/dotenv": "^6.0|^7.0" + "symfony/dotenv": "^8.0|^7.4" }, "autoload": { "psr-4": { From db3c8adec58dae3b3d447442d8acb3fe154a7397 Mon Sep 17 00:00:00 2001 From: Odin Date: Sat, 27 Jun 2026 11:18:24 +0200 Subject: [PATCH 10/11] chore: upgrade doctrine/doctrine-bundle to ^3.0 --- libs/doctrine-retry-bundle/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/doctrine-retry-bundle/composer.json b/libs/doctrine-retry-bundle/composer.json index 80cc68f15..0c643d9de 100644 --- a/libs/doctrine-retry-bundle/composer.json +++ b/libs/doctrine-retry-bundle/composer.json @@ -12,7 +12,7 @@ "require": { "php": "^8.4", "doctrine/dbal": "^4.2", - "doctrine/doctrine-bundle": "^2.1", + "doctrine/doctrine-bundle": "^3.0", "keboola/retry": "^0.5.0", "symfony/dependency-injection": "^8.0|^7.4", "symfony/http-kernel": "^8.0|^7.4" From a2b3ccb6c420933c557ffd2c4ef5bc2937de941b Mon Sep 17 00:00:00 2001 From: Odin Date: Sat, 27 Jun 2026 11:19:29 +0200 Subject: [PATCH 11/11] chore: remove rector/rector --- libs/doctrine-retry-bundle/composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/doctrine-retry-bundle/composer.json b/libs/doctrine-retry-bundle/composer.json index 0c643d9de..a49a78cf5 100644 --- a/libs/doctrine-retry-bundle/composer.json +++ b/libs/doctrine-retry-bundle/composer.json @@ -27,7 +27,6 @@ "phpstan/phpstan-phpunit": "^2.0", "phpstan/phpstan-symfony": "^2.0", "phpunit/phpunit": "^13.0", - "rector/rector": "^1.2 || ^2.0", "symfony/dotenv": "^8.0|^7.4" }, "autoload": {