From 8fbf0a20d782e20471cc48fe69a6b77c70273b9e Mon Sep 17 00:00:00 2001 From: David Badura Date: Wed, 13 Dec 2023 15:51:48 +0100 Subject: [PATCH 1/7] try dbal 4 --- .github/workflows/integration.yml | 6 +- composer.json | 2 +- composer.lock | 463 +++++++++++++++--------------- phpunit.xml.dist | 2 +- tests/Integration/DbalManager.php | 7 +- 5 files changed, 242 insertions(+), 238 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index fb0a169f0..7743a8765 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -44,7 +44,7 @@ jobs: - "16.1" env: - DB_URL: 'postgresql://postgres:postgres@localhost:5432/eventstore?charset=utf8' + DB_URL: 'pdo_pgsql://postgres:postgres@localhost:5432/eventstore?charset=utf8' steps: - name: "Checkout" @@ -97,7 +97,7 @@ jobs: - "11.2" env: - DB_URL: 'mysql://root@127.0.0.1:3306/eventstore?charset=utf8' + DB_URL: 'pdo_mysql://root@127.0.0.1:3306/eventstore?charset=utf8' steps: - name: "Checkout" @@ -150,7 +150,7 @@ jobs: - "8.2" env: - DB_URL: 'mysql://root@127.0.0.1:3306/eventstore?charset=utf8' + DB_URL: 'pdo_mysql://root@127.0.0.1:3306/eventstore?charset=utf8' steps: - name: "Checkout" diff --git a/composer.json b/composer.json index a862a9739..268fc8e24 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ ], "require": { "php": "~8.1.0 || ~8.2.0 || ~8.3.0", - "doctrine/dbal": "^3.8.0", + "doctrine/dbal": "4.0.0 as 3.8.0", "patchlevel/hydrator": "^1.1.0", "patchlevel/worker": "^1.1.1", "psr/cache": "^2.0.0|^3.0.0", diff --git a/composer.lock b/composer.lock index db8447201..88b8eaf4b 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": "35c83bd2024057b56c882a16545c9568", + "content-hash": "bee052fbfd39d2633c226fc544822606", "packages": [ { "name": "brick/math", @@ -61,142 +61,44 @@ ], "time": "2023-01-15T23:15:59+00:00" }, - { - "name": "doctrine/cache", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/cache.git", - "reference": "1ca8f21980e770095a31456042471a57bc4c68fb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/1ca8f21980e770095a31456042471a57bc4c68fb", - "reference": "1ca8f21980e770095a31456042471a57bc4c68fb", - "shasum": "" - }, - "require": { - "php": "~7.1 || ^8.0" - }, - "conflict": { - "doctrine/common": ">2.2,<2.4" - }, - "require-dev": { - "cache/integration-tests": "dev-master", - "doctrine/coding-standard": "^9", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "psr/cache": "^1.0 || ^2.0 || ^3.0", - "symfony/cache": "^4.4 || ^5.4 || ^6", - "symfony/var-exporter": "^4.4 || ^5.4 || ^6" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.", - "homepage": "https://www.doctrine-project.org/projects/cache.html", - "keywords": [ - "abstraction", - "apcu", - "cache", - "caching", - "couchdb", - "memcached", - "php", - "redis", - "xcache" - ], - "support": { - "issues": "https://github.com/doctrine/cache/issues", - "source": "https://github.com/doctrine/cache/tree/2.2.0" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcache", - "type": "tidelift" - } - ], - "time": "2022-05-20T20:07:39+00:00" - }, { "name": "doctrine/dbal", - "version": "3.8.0", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "d244f2e6e6bf32bff5174e6729b57214923ecec9" + "reference": "53df8c432978b716a805143eb701436d54ec705e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/d244f2e6e6bf32bff5174e6729b57214923ecec9", - "reference": "d244f2e6e6bf32bff5174e6729b57214923ecec9", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/53df8c432978b716a805143eb701436d54ec705e", + "reference": "53df8c432978b716a805143eb701436d54ec705e", "shasum": "" }, "require": { - "composer-runtime-api": "^2", - "doctrine/cache": "^1.11|^2.0", "doctrine/deprecations": "^0.5.3|^1", - "doctrine/event-manager": "^1|^2", - "php": "^7.4 || ^8.0", + "php": "^8.1", "psr/cache": "^1|^2|^3", "psr/log": "^1|^2|^3" }, "require-dev": { "doctrine/coding-standard": "12.0.0", "fig/log-test": "^1", - "jetbrains/phpstorm-stubs": "2023.1", - "phpstan/phpstan": "1.10.56", + "jetbrains/phpstorm-stubs": "2023.2", + "phpstan/phpstan": "1.10.57", + "phpstan/phpstan-phpunit": "1.3.15", "phpstan/phpstan-strict-rules": "^1.5", - "phpunit/phpunit": "9.6.15", + "phpunit/phpunit": "10.5.9", "psalm/plugin-phpunit": "0.18.4", "slevomat/coding-standard": "8.13.1", "squizlabs/php_codesniffer": "3.8.1", - "symfony/cache": "^5.4|^6.0|^7.0", - "symfony/console": "^4.4|^5.4|^6.0|^7.0", - "vimeo/psalm": "4.30.0" + "symfony/cache": "^6.3.8|^7.0", + "symfony/console": "^5.4|^6.3|^7.0", + "vimeo/psalm": "5.16.0" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." }, - "bin": [ - "bin/doctrine-dbal" - ], "type": "library", "autoload": { "psr-4": { @@ -249,7 +151,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.8.0" + "source": "https://github.com/doctrine/dbal/tree/4.0.0" }, "funding": [ { @@ -265,7 +167,7 @@ "type": "tidelift" } ], - "time": "2024-01-25T21:44:02+00:00" + "time": "2024-02-03T19:11:19+00:00" }, { "name": "doctrine/deprecations", @@ -314,97 +216,6 @@ }, "time": "2024-01-30T19:34:25+00:00" }, - { - "name": "doctrine/event-manager", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/event-manager.git", - "reference": "750671534e0241a7c50ea5b43f67e23eb5c96f32" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/event-manager/zipball/750671534e0241a7c50ea5b43f67e23eb5c96f32", - "reference": "750671534e0241a7c50ea5b43f67e23eb5c96f32", - "shasum": "" - }, - "require": { - "php": "^8.1" - }, - "conflict": { - "doctrine/common": "<2.9" - }, - "require-dev": { - "doctrine/coding-standard": "^10", - "phpstan/phpstan": "^1.8.8", - "phpunit/phpunit": "^9.5", - "vimeo/psalm": "^4.28" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Common\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - }, - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - } - ], - "description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.", - "homepage": "https://www.doctrine-project.org/projects/event-manager.html", - "keywords": [ - "event", - "event dispatcher", - "event manager", - "event system", - "events" - ], - "support": { - "issues": "https://github.com/doctrine/event-manager/issues", - "source": "https://github.com/doctrine/event-manager/tree/2.0.0" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fevent-manager", - "type": "tidelift" - } - ], - "time": "2022-10-12T20:59:15+00:00" - }, { "name": "patchlevel/hydrator", "version": "1.1.0", @@ -2696,6 +2507,99 @@ }, "time": "2023-02-02T22:02:53+00:00" }, + { + "name": "doctrine/cache", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "1ca8f21980e770095a31456042471a57bc4c68fb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/1ca8f21980e770095a31456042471a57bc4c68fb", + "reference": "1ca8f21980e770095a31456042471a57bc4c68fb", + "shasum": "" + }, + "require": { + "php": "~7.1 || ^8.0" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "cache/integration-tests": "dev-master", + "doctrine/coding-standard": "^9", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psr/cache": "^1.0 || ^2.0 || ^3.0", + "symfony/cache": "^4.4 || ^5.4 || ^6", + "symfony/var-exporter": "^4.4 || ^5.4 || ^6" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.", + "homepage": "https://www.doctrine-project.org/projects/cache.html", + "keywords": [ + "abstraction", + "apcu", + "cache", + "caching", + "couchdb", + "memcached", + "php", + "redis", + "xcache" + ], + "support": { + "issues": "https://github.com/doctrine/cache/issues", + "source": "https://github.com/doctrine/cache/tree/2.2.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcache", + "type": "tidelift" + } + ], + "time": "2022-05-20T20:07:39+00:00" + }, { "name": "doctrine/collections", "version": "2.1.4", @@ -2873,6 +2777,97 @@ ], "time": "2022-10-09T11:47:59+00:00" }, + { + "name": "doctrine/event-manager", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/event-manager.git", + "reference": "750671534e0241a7c50ea5b43f67e23eb5c96f32" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/750671534e0241a7c50ea5b43f67e23eb5c96f32", + "reference": "750671534e0241a7c50ea5b43f67e23eb5c96f32", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "conflict": { + "doctrine/common": "<2.9" + }, + "require-dev": { + "doctrine/coding-standard": "^10", + "phpstan/phpstan": "^1.8.8", + "phpunit/phpunit": "^9.5", + "vimeo/psalm": "^4.28" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + }, + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.", + "homepage": "https://www.doctrine-project.org/projects/event-manager.html", + "keywords": [ + "event", + "event dispatcher", + "event manager", + "event system", + "events" + ], + "support": { + "issues": "https://github.com/doctrine/event-manager/issues", + "source": "https://github.com/doctrine/event-manager/tree/2.0.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fevent-manager", + "type": "tidelift" + } + ], + "time": "2022-10-12T20:59:15+00:00" + }, { "name": "doctrine/inflector", "version": "2.0.9", @@ -3036,28 +3031,27 @@ }, { "name": "doctrine/lexer", - "version": "2.1.0", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124" + "reference": "84a527db05647743d50373e0ec53a152f2cde568" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", - "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/84a527db05647743d50373e0ec53a152f2cde568", + "reference": "84a527db05647743d50373e0ec53a152f2cde568", "shasum": "" }, "require": { - "doctrine/deprecations": "^1.0", - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^10", - "phpstan/phpstan": "^1.3", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "doctrine/coding-standard": "^10", + "phpstan/phpstan": "^1.9", + "phpunit/phpunit": "^9.5", "psalm/plugin-phpunit": "^0.18.3", - "vimeo/psalm": "^4.11 || ^5.0" + "vimeo/psalm": "^5.0" }, "type": "library", "autoload": { @@ -3094,7 +3088,7 @@ ], "support": { "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/2.1.0" + "source": "https://github.com/doctrine/lexer/tree/3.0.0" }, "funding": [ { @@ -3110,7 +3104,7 @@ "type": "tidelift" } ], - "time": "2022-12-14T08:49:07+00:00" + "time": "2022-12-15T16:57:16+00:00" }, { "name": "doctrine/migrations", @@ -3216,16 +3210,16 @@ }, { "name": "doctrine/orm", - "version": "2.17.4", + "version": "2.18.0", "source": { "type": "git", "url": "https://github.com/doctrine/orm.git", - "reference": "ccfc97c32f63aaa0988ac6aa42e71c5590bb794d" + "reference": "f2176a9ce56cafdfd1624d54bfdb076819083d5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/orm/zipball/ccfc97c32f63aaa0988ac6aa42e71c5590bb794d", - "reference": "ccfc97c32f63aaa0988ac6aa42e71c5590bb794d", + "url": "https://api.github.com/repos/doctrine/orm/zipball/f2176a9ce56cafdfd1624d54bfdb076819083d5b", + "reference": "f2176a9ce56cafdfd1624d54bfdb076819083d5b", "shasum": "" }, "require": { @@ -3238,7 +3232,7 @@ "doctrine/event-manager": "^1.2 || ^2", "doctrine/inflector": "^1.4 || ^2.0", "doctrine/instantiator": "^1.3 || ^2", - "doctrine/lexer": "^2", + "doctrine/lexer": "^2 || ^3", "doctrine/persistence": "^2.4 || ^3", "ext-ctype": "*", "php": "^7.1 || ^8.0", @@ -3274,7 +3268,7 @@ "type": "library", "autoload": { "psr-4": { - "Doctrine\\ORM\\": "lib/Doctrine/ORM" + "Doctrine\\ORM\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -3311,9 +3305,9 @@ ], "support": { "issues": "https://github.com/doctrine/orm/issues", - "source": "https://github.com/doctrine/orm/tree/2.17.4" + "source": "https://github.com/doctrine/orm/tree/2.18.0" }, - "time": "2024-01-26T19:41:16+00:00" + "time": "2024-01-31T15:53:12+00:00" }, { "name": "doctrine/persistence", @@ -5341,16 +5335,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.5.9", + "version": "10.5.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "0bd663704f0165c9e76fe4f06ffa6a1ca727fdbe" + "reference": "50b8e314b6d0dd06521dc31d1abffa73f25f850c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0bd663704f0165c9e76fe4f06ffa6a1ca727fdbe", - "reference": "0bd663704f0165c9e76fe4f06ffa6a1ca727fdbe", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/50b8e314b6d0dd06521dc31d1abffa73f25f850c", + "reference": "50b8e314b6d0dd06521dc31d1abffa73f25f850c", "shasum": "" }, "require": { @@ -5422,7 +5416,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.9" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.10" }, "funding": [ { @@ -5438,7 +5432,7 @@ "type": "tidelift" } ], - "time": "2024-01-22T14:35:40+00:00" + "time": "2024-02-04T09:07:51+00:00" }, { "name": "psalm/plugin-phpunit", @@ -8150,7 +8144,14 @@ "time": "2022-05-24T19:45:58+00:00" } ], - "aliases": [], + "aliases": [ + { + "package": "doctrine/dbal", + "version": "4.0.0.0", + "alias": "3.8.0", + "alias_normalized": "3.8.0.0" + } + ], "minimum-stability": "stable", "stability-flags": [], "prefer-stable": false, diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 000d0cb80..31afe8e31 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -27,7 +27,7 @@ - + diff --git a/tests/Integration/DbalManager.php b/tests/Integration/DbalManager.php index 9dbebb18e..ada2cf92b 100644 --- a/tests/Integration/DbalManager.php +++ b/tests/Integration/DbalManager.php @@ -7,6 +7,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Driver\AbstractSQLiteDriver; use Doctrine\DBAL\DriverManager; +use Doctrine\DBAL\Tools\DsnParser; use Patchlevel\EventSourcing\Console\DoctrineHelper; use RuntimeException; @@ -27,11 +28,13 @@ public static function createConnection(string $dbName = self::DEFAULT_DB_NAME): throw new RuntimeException('missing DB_URL env'); } + $connectionParams = (new DsnParser())->parse($dbUrl); + if ($dbName !== self::DEFAULT_DB_NAME) { - $dbUrl = str_replace(self::DEFAULT_DB_NAME, $dbName, $dbUrl); + $connectionParams['dbname'] = $dbName; } - $connection = DriverManager::getConnection(['url' => $dbUrl]); + $connection = DriverManager::getConnection($connectionParams); if ($connection->getDriver() instanceof AbstractSQLiteDriver) { return $connection; From 69c1714803746e7a7673edd51ec07dbc819e989b Mon Sep 17 00:00:00 2001 From: David Badura Date: Sun, 4 Feb 2024 10:47:46 +0100 Subject: [PATCH 2/7] allow dbal 4 and orm 3 --- composer.json | 4 +- composer.lock | 324 ++++---------------------------------------------- 2 files changed, 24 insertions(+), 304 deletions(-) diff --git a/composer.json b/composer.json index 268fc8e24..004c8fe31 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ ], "require": { "php": "~8.1.0 || ~8.2.0 || ~8.3.0", - "doctrine/dbal": "4.0.0 as 3.8.0", + "doctrine/dbal": "^3.8.1|^4.0.0", "patchlevel/hydrator": "^1.1.0", "patchlevel/worker": "^1.1.1", "psr/cache": "^2.0.0|^3.0.0", @@ -37,7 +37,7 @@ "ext-pdo_sqlite": "~8.1.0 || ~8.2.0 || ~8.3.0", "cspray/phinal": "^2.0.0", "doctrine/migrations": "^3.3.2", - "doctrine/orm": "^2.0.0", + "doctrine/orm": "^2.18.0|^3.0.0", "infection/infection": "^0.27.0", "patchlevel/coding-standard": "^1.3.0", "patchlevel/event-sourcing-psalm-plugin": "^2.1.0", diff --git a/composer.lock b/composer.lock index 88b8eaf4b..9405145bd 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": "bee052fbfd39d2633c226fc544822606", + "content-hash": "002d11a96fec569f20a4569965f328df", "packages": [ { "name": "brick/math", @@ -2507,99 +2507,6 @@ }, "time": "2023-02-02T22:02:53+00:00" }, - { - "name": "doctrine/cache", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/cache.git", - "reference": "1ca8f21980e770095a31456042471a57bc4c68fb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/1ca8f21980e770095a31456042471a57bc4c68fb", - "reference": "1ca8f21980e770095a31456042471a57bc4c68fb", - "shasum": "" - }, - "require": { - "php": "~7.1 || ^8.0" - }, - "conflict": { - "doctrine/common": ">2.2,<2.4" - }, - "require-dev": { - "cache/integration-tests": "dev-master", - "doctrine/coding-standard": "^9", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "psr/cache": "^1.0 || ^2.0 || ^3.0", - "symfony/cache": "^4.4 || ^5.4 || ^6", - "symfony/var-exporter": "^4.4 || ^5.4 || ^6" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.", - "homepage": "https://www.doctrine-project.org/projects/cache.html", - "keywords": [ - "abstraction", - "apcu", - "cache", - "caching", - "couchdb", - "memcached", - "php", - "redis", - "xcache" - ], - "support": { - "issues": "https://github.com/doctrine/cache/issues", - "source": "https://github.com/doctrine/cache/tree/2.2.0" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcache", - "type": "tidelift" - } - ], - "time": "2022-05-20T20:07:39+00:00" - }, { "name": "doctrine/collections", "version": "2.1.4", @@ -2686,97 +2593,6 @@ ], "time": "2023-10-03T09:22:33+00:00" }, - { - "name": "doctrine/common", - "version": "3.4.3", - "source": { - "type": "git", - "url": "https://github.com/doctrine/common.git", - "reference": "8b5e5650391f851ed58910b3e3d48a71062eeced" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/common/zipball/8b5e5650391f851ed58910b3e3d48a71062eeced", - "reference": "8b5e5650391f851ed58910b3e3d48a71062eeced", - "shasum": "" - }, - "require": { - "doctrine/persistence": "^2.0 || ^3.0", - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^9.0 || ^10.0", - "doctrine/collections": "^1", - "phpstan/phpstan": "^1.4.1", - "phpstan/phpstan-phpunit": "^1", - "phpunit/phpunit": "^7.5.20 || ^8.5 || ^9.0", - "squizlabs/php_codesniffer": "^3.0", - "symfony/phpunit-bridge": "^6.1", - "vimeo/psalm": "^4.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Common\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - }, - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - } - ], - "description": "PHP Doctrine Common project is a library that provides additional functionality that other Doctrine projects depend on such as better reflection support, proxies and much more.", - "homepage": "https://www.doctrine-project.org/projects/common.html", - "keywords": [ - "common", - "doctrine", - "php" - ], - "support": { - "issues": "https://github.com/doctrine/common/issues", - "source": "https://github.com/doctrine/common/tree/3.4.3" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcommon", - "type": "tidelift" - } - ], - "time": "2022-10-09T11:47:59+00:00" - }, { "name": "doctrine/event-manager", "version": "2.0.0", @@ -3210,61 +3026,48 @@ }, { "name": "doctrine/orm", - "version": "2.18.0", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/orm.git", - "reference": "f2176a9ce56cafdfd1624d54bfdb076819083d5b" + "reference": "5b8b5f28f535e1f03b54dcfb0427407ed92f5b72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/orm/zipball/f2176a9ce56cafdfd1624d54bfdb076819083d5b", - "reference": "f2176a9ce56cafdfd1624d54bfdb076819083d5b", + "url": "https://api.github.com/repos/doctrine/orm/zipball/5b8b5f28f535e1f03b54dcfb0427407ed92f5b72", + "reference": "5b8b5f28f535e1f03b54dcfb0427407ed92f5b72", "shasum": "" }, "require": { "composer-runtime-api": "^2", - "doctrine/cache": "^1.12.1 || ^2.1.1", - "doctrine/collections": "^1.5 || ^2.1", - "doctrine/common": "^3.0.3", - "doctrine/dbal": "^2.13.1 || ^3.2", + "doctrine/collections": "^2.1", + "doctrine/dbal": "^3.6 || ^4", "doctrine/deprecations": "^0.5.3 || ^1", "doctrine/event-manager": "^1.2 || ^2", "doctrine/inflector": "^1.4 || ^2.0", "doctrine/instantiator": "^1.3 || ^2", - "doctrine/lexer": "^2 || ^3", - "doctrine/persistence": "^2.4 || ^3", + "doctrine/lexer": "^3", + "doctrine/persistence": "^3.1.1", "ext-ctype": "*", - "php": "^7.1 || ^8.0", + "php": "^8.1", "psr/cache": "^1 || ^2 || ^3", - "symfony/console": "^4.2 || ^5.0 || ^6.0 || ^7.0", - "symfony/polyfill-php72": "^1.23", - "symfony/polyfill-php80": "^1.16" - }, - "conflict": { - "doctrine/annotations": "<1.13 || >= 3.0" + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/var-exporter": "~6.2.13 || ^6.3.2 || ^7.0" }, "require-dev": { - "doctrine/annotations": "^1.13 || ^2", - "doctrine/coding-standard": "^9.0.2 || ^12.0", - "phpbench/phpbench": "^0.16.10 || ^1.0", - "phpstan/phpstan": "~1.4.10 || 1.10.35", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6", + "doctrine/coding-standard": "^12.0", + "phpbench/phpbench": "^1.0", + "phpstan/phpstan": "1.10.35", + "phpunit/phpunit": "^10.4.0", "psr/log": "^1 || ^2 || ^3", "squizlabs/php_codesniffer": "3.7.2", - "symfony/cache": "^4.4 || ^5.4 || ^6.4 || ^7.0", - "symfony/var-exporter": "^4.4 || ^5.4 || ^6.2 || ^7.0", - "symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0 || ^7.0", - "vimeo/psalm": "4.30.0 || 5.16.0" + "symfony/cache": "^5.4 || ^6.2 || ^7.0", + "vimeo/psalm": "5.16.0" }, "suggest": { "ext-dom": "Provides support for XSD validation for XML mapping files", - "symfony/cache": "Provides cache support for Setup Tool with doctrine/cache 2.0", - "symfony/yaml": "If you want to use YAML Metadata Mapping Driver" + "symfony/cache": "Provides cache support for Setup Tool with doctrine/cache 2.0" }, - "bin": [ - "bin/doctrine" - ], "type": "library", "autoload": { "psr-4": { @@ -3305,9 +3108,9 @@ ], "support": { "issues": "https://github.com/doctrine/orm/issues", - "source": "https://github.com/doctrine/orm/tree/2.18.0" + "source": "https://github.com/doctrine/orm/tree/3.0.0" }, - "time": "2024-01-31T15:53:12+00:00" + "time": "2024-02-03T16:50:09+00:00" }, { "name": "doctrine/persistence", @@ -7218,82 +7021,6 @@ ], "time": "2023-08-08T10:20:21+00:00" }, - { - "name": "symfony/polyfill-php72", - "version": "v1.28.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/70f4aebd92afca2f865444d30a4d2151c13c3179", - "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - } - }, - "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": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.28.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": "2023-01-26T09:26:14+00:00" - }, { "name": "symfony/polyfill-php80", "version": "v1.28.0", @@ -8144,14 +7871,7 @@ "time": "2022-05-24T19:45:58+00:00" } ], - "aliases": [ - { - "package": "doctrine/dbal", - "version": "4.0.0.0", - "alias": "3.8.0", - "alias_normalized": "3.8.0.0" - } - ], + "aliases": [], "minimum-stability": "stable", "stability-flags": [], "prefer-stable": false, From 97e36d24cfa67de728dfd1151fcab51583101076 Mon Sep 17 00:00:00 2001 From: David Badura Date: Sun, 4 Feb 2024 11:01:12 +0100 Subject: [PATCH 3/7] fix tests and static analyser --- phpstan-baseline.neon | 6 +++++- src/Store/DoctrineDbalStore.php | 3 ++- tests/Integration/DbalManager.php | 1 - .../Unit/Schema/DoctrineSchemaDirectorTest.php | 17 +++++++++-------- tests/Unit/Store/DoctrineDbalStoreTest.php | 2 +- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index ce6b1d33a..7acd5c954 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,5 +1,10 @@ parameters: ignoreErrors: + - + message: "#^Cannot unset offset 'url' on array\\{application_name\\?\\: string, charset\\?\\: string, dbname\\?\\: string, defaultTableOptions\\?\\: array\\, driver\\?\\: 'ibm_db2'\\|'mysqli'\\|'oci8'\\|'pdo_mysql'\\|'pdo_oci'\\|'pdo_pgsql'\\|'pdo_sqlite'\\|'pdo_sqlsrv'\\|'pgsql'\\|'sqlite3'\\|'sqlsrv', driverClass\\?\\: class\\-string\\, driverOptions\\?\\: array, host\\?\\: string, \\.\\.\\.\\}\\.$#" + count: 1 + path: src/Console/DoctrineHelper.php + - message: "#^Method Patchlevel\\\\EventSourcing\\\\EventBus\\\\Message\\:\\:headers\\(\\) should return array\\{aggregateClass\\?\\: class\\-string\\, aggregateId\\?\\: string, playhead\\?\\: int\\<1, max\\>, recordedOn\\?\\: DateTimeImmutable, newStreamStart\\?\\: bool, archived\\?\\: bool\\} but returns non\\-empty\\-array\\\\.$#" count: 1 @@ -39,4 +44,3 @@ parameters: message: "#^While loop condition is always true\\.$#" count: 1 path: src/WatchServer/SocketWatchServer.php - diff --git a/src/Store/DoctrineDbalStore.php b/src/Store/DoctrineDbalStore.php index 0802f16ee..0d6cdf98e 100644 --- a/src/Store/DoctrineDbalStore.php +++ b/src/Store/DoctrineDbalStore.php @@ -130,7 +130,7 @@ function (Connection $connection) use ($messages): void { $parameters = []; $placeholders = []; - /** @var array $types */ + /** @var array, Type> $types */ $types = []; $columns = [ @@ -149,6 +149,7 @@ function (Connection $connection) use ($messages): void { $placeholder = implode(', ', array_fill(0, $columnsLength, '?')); foreach ($messages as $position => $message) { + /** @var int<0, max> $offset */ $offset = (int)$position * $columnsLength; $placeholders[] = $placeholder; diff --git a/tests/Integration/DbalManager.php b/tests/Integration/DbalManager.php index ada2cf92b..22234156c 100644 --- a/tests/Integration/DbalManager.php +++ b/tests/Integration/DbalManager.php @@ -14,7 +14,6 @@ use function getenv; use function in_array; use function is_string; -use function str_replace; final class DbalManager { diff --git a/tests/Unit/Schema/DoctrineSchemaDirectorTest.php b/tests/Unit/Schema/DoctrineSchemaDirectorTest.php index 7cf00c8d0..d5ebcdf08 100644 --- a/tests/Unit/Schema/DoctrineSchemaDirectorTest.php +++ b/tests/Unit/Schema/DoctrineSchemaDirectorTest.php @@ -9,6 +9,7 @@ use Doctrine\DBAL\Schema\AbstractSchemaManager; use Doctrine\DBAL\Schema\Comparator; use Doctrine\DBAL\Schema\Schema; +use Doctrine\DBAL\Schema\SchemaConfig; use Doctrine\DBAL\Schema\SchemaDiff; use Patchlevel\EventSourcing\Schema\DoctrineSchemaDirector; use Patchlevel\EventSourcing\Schema\SchemaConfigurator; @@ -24,10 +25,10 @@ final class DoctrineSchemaDirectorTest extends TestCase public function testCreate(): void { $schemaManager = $this->prophesize(AbstractSchemaManager::class); - $schemaManager->createSchemaConfig()->willReturn(); + $schemaManager->createSchemaConfig()->willReturn(new SchemaConfig()); $platform = $this->prophesize(AbstractPlatform::class); - $platform->getCreateTablesSQL(Argument::any(), Argument::any())->willReturn(['this is sql!']); + $platform->getCreateTablesSQL(Argument::any())->willReturn(['this is sql!']); $platform->supportsSchemas()->willReturn(false); $connection = $this->prophesize(Connection::class); @@ -49,10 +50,10 @@ public function testCreate(): void public function testDryRunCreate(): void { $schemaManager = $this->prophesize(AbstractSchemaManager::class); - $schemaManager->createSchemaConfig()->willReturn(); + $schemaManager->createSchemaConfig()->willReturn(new SchemaConfig()); $platform = $this->prophesize(AbstractPlatform::class); - $platform->getCreateTablesSQL(Argument::any(), Argument::any())->willReturn(['this is sql!']); + $platform->getCreateTablesSQL(Argument::any())->willReturn(['this is sql!']); $platform->supportsSchemas()->willReturn(false); $connection = $this->prophesize(Connection::class); @@ -84,7 +85,7 @@ public function testUpdate(): void $schemaManager = $this->prophesize(AbstractSchemaManager::class); $schemaManager->createComparator()->willReturn($comperator->reveal()); $schemaManager->introspectSchema()->willReturn($fromSchema->reveal()); - $schemaManager->createSchemaConfig()->willReturn(); + $schemaManager->createSchemaConfig()->willReturn(new SchemaConfig()); $platform = $this->prophesize(AbstractPlatform::class); $platform->getAlterSchemaSQL($diff->reveal())->willReturn(['x', 'y']); @@ -118,7 +119,7 @@ public function testDryRunUpdate(): void $schemaManager = $this->prophesize(AbstractSchemaManager::class); $schemaManager->createComparator()->willReturn($comperator->reveal()); $schemaManager->introspectSchema()->willReturn($fromSchema->reveal()); - $schemaManager->createSchemaConfig()->willReturn(); + $schemaManager->createSchemaConfig()->willReturn(new SchemaConfig()); $platform = $this->prophesize(AbstractPlatform::class); $platform->getAlterSchemaSQL($diff->reveal())->willReturn(['x', 'y']); @@ -145,7 +146,7 @@ public function testDrop(): void $connection = $this->prophesize(Connection::class); $currentSchema = $this->prophesize(Schema::class); $schemaManager = $this->prophesize(AbstractSchemaManager::class); - $schemaManager->createSchemaConfig()->willReturn(); + $schemaManager->createSchemaConfig()->willReturn(new SchemaConfig()); $currentSchema->hasTable('foo')->willReturn(true); $currentSchema->hasTable('bar')->willReturn(false); @@ -177,7 +178,7 @@ public function testDryRunDrop(): void $connection = $this->prophesize(Connection::class); $currentSchema = $this->prophesize(Schema::class); $schemaManager = $this->prophesize(AbstractSchemaManager::class); - $schemaManager->createSchemaConfig()->willReturn(); + $schemaManager->createSchemaConfig()->willReturn(new SchemaConfig()); $currentSchema->hasTable('foo')->willReturn(true); $currentSchema->hasTable('bar')->willReturn(false); diff --git a/tests/Unit/Store/DoctrineDbalStoreTest.php b/tests/Unit/Store/DoctrineDbalStoreTest.php index fb38dfe8a..c5810a7a2 100644 --- a/tests/Unit/Store/DoctrineDbalStoreTest.php +++ b/tests/Unit/Store/DoctrineDbalStoreTest.php @@ -182,7 +182,7 @@ public function testTransactional(): void }; $connection = $this->prophesize(Connection::class); - $connection->transactional($callback)->shouldBeCalled(); + $connection->transactional($callback)->willReturn(null)->shouldBeCalled(); $serializer = $this->prophesize(EventSerializer::class); From 37d2c3605ce211c5783f3114f9eaf399f47f1e37 Mon Sep 17 00:00:00 2001 From: David Badura Date: Sun, 4 Feb 2024 11:09:09 +0100 Subject: [PATCH 4/7] fix db url for integration tests --- .github/workflows/integration.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 7743a8765..935e0ee01 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -44,7 +44,7 @@ jobs: - "16.1" env: - DB_URL: 'pdo_pgsql://postgres:postgres@localhost:5432/eventstore?charset=utf8' + DB_URL: 'pdo-pgsql://postgres:postgres@localhost:5432/eventstore?charset=utf8' steps: - name: "Checkout" @@ -56,7 +56,7 @@ jobs: coverage: "pcov" php-version: "${{ matrix.php-version }}" ini-values: memory_limit=-1 - extensions: pdo_sqlite + extensions: pdo_pgsql - uses: ramsey/composer-install@2.2.0 with: @@ -97,7 +97,7 @@ jobs: - "11.2" env: - DB_URL: 'pdo_mysql://root@127.0.0.1:3306/eventstore?charset=utf8' + DB_URL: 'pdo-mysql://root@127.0.0.1:3306/eventstore?charset=utf8' steps: - name: "Checkout" @@ -150,7 +150,7 @@ jobs: - "8.2" env: - DB_URL: 'pdo_mysql://root@127.0.0.1:3306/eventstore?charset=utf8' + DB_URL: 'pdo-mysql://root@127.0.0.1:3306/eventstore?charset=utf8' steps: - name: "Checkout" From 1a6ecdb1abae9e3965da6de6709c07dd43048b12 Mon Sep 17 00:00:00 2001 From: David Badura Date: Sun, 4 Feb 2024 11:15:50 +0100 Subject: [PATCH 5/7] add string length --- src/Outbox/DoctrineOutboxStore.php | 3 +++ src/Projection/Projection/Store/DoctrineStore.php | 3 +++ src/Store/DoctrineDbalStore.php | 3 +++ 3 files changed, 9 insertions(+) diff --git a/src/Outbox/DoctrineOutboxStore.php b/src/Outbox/DoctrineOutboxStore.php index 3cb014a98..b09add21a 100644 --- a/src/Outbox/DoctrineOutboxStore.php +++ b/src/Outbox/DoctrineOutboxStore.php @@ -126,12 +126,15 @@ public function configureSchema(Schema $schema, Connection $connection): void $table = $schema->createTable($this->outboxTable); $table->addColumn('aggregate', Types::STRING) + ->setLength(255) ->setNotnull(true); $table->addColumn('aggregate_id', Types::STRING) + ->setLength(32) ->setNotnull(true); $table->addColumn('playhead', Types::INTEGER) ->setNotnull(true); $table->addColumn('event', Types::STRING) + ->setLength(255) ->setNotnull(true); $table->addColumn('payload', Types::JSON) ->setNotnull(true); diff --git a/src/Projection/Projection/Store/DoctrineStore.php b/src/Projection/Projection/Store/DoctrineStore.php index 3284b43fb..5035b43f8 100644 --- a/src/Projection/Projection/Store/DoctrineStore.php +++ b/src/Projection/Projection/Store/DoctrineStore.php @@ -160,14 +160,17 @@ public function configureSchema(Schema $schema, Connection $connection): void $table = $schema->createTable($this->projectionTable); $table->addColumn('name', Types::STRING) + ->setLength(255) ->setNotnull(true); $table->addColumn('version', Types::INTEGER) ->setNotnull(true); $table->addColumn('position', Types::INTEGER) ->setNotnull(true); $table->addColumn('status', Types::STRING) + ->setLength(32) ->setNotnull(true); $table->addColumn('error_message', Types::STRING) + ->setLength(255) ->setNotnull(false); $table->addColumn('error_context', Types::JSON) ->setNotnull(false); diff --git a/src/Store/DoctrineDbalStore.php b/src/Store/DoctrineDbalStore.php index 0d6cdf98e..67cda302e 100644 --- a/src/Store/DoctrineDbalStore.php +++ b/src/Store/DoctrineDbalStore.php @@ -238,12 +238,15 @@ public function configureSchema(Schema $schema, Connection $connection): void ->setAutoincrement(true) ->setNotnull(true); $table->addColumn('aggregate', Types::STRING) + ->setLength(255) ->setNotnull(true); $table->addColumn('aggregate_id', Types::STRING) + ->setLength(36) ->setNotnull(true); $table->addColumn('playhead', Types::INTEGER) ->setNotnull(true); $table->addColumn('event', Types::STRING) + ->setLength(255) ->setNotnull(true); $table->addColumn('payload', Types::JSON) ->setNotnull(true); From 068c89a578be3b9d75adacfa6ba655c0b2806040 Mon Sep 17 00:00:00 2001 From: David Badura Date: Sun, 4 Feb 2024 11:20:59 +0100 Subject: [PATCH 6/7] fix integration tests --- tests/Integration/BankAccountSplitStream/IntegrationTest.php | 3 ++- .../Projection/BankAccountProjector.php | 4 ++-- .../Integration/BasicImplementation/BasicIntegrationTest.php | 5 +++-- .../BasicImplementation/Projection/ProfileProjector.php | 4 ++-- tests/Integration/Outbox/OutboxTest.php | 3 ++- tests/Integration/Outbox/Projection/ProfileProjector.php | 4 ++-- .../Projectionist/Projection/ProfileProjector.php | 4 ++-- tests/Integration/Projectionist/ProjectionistTest.php | 5 +++-- 8 files changed, 18 insertions(+), 14 deletions(-) diff --git a/tests/Integration/BankAccountSplitStream/IntegrationTest.php b/tests/Integration/BankAccountSplitStream/IntegrationTest.php index b8b58a7e4..e29ebd70e 100644 --- a/tests/Integration/BankAccountSplitStream/IntegrationTest.php +++ b/tests/Integration/BankAccountSplitStream/IntegrationTest.php @@ -11,6 +11,7 @@ use Patchlevel\EventSourcing\Metadata\AggregateRoot\AggregateRootRegistry; use Patchlevel\EventSourcing\Metadata\AggregateRoot\AttributeAggregateRootRegistryFactory; use Patchlevel\EventSourcing\Metadata\Event\AttributeEventMetadataFactory; +use Patchlevel\EventSourcing\Projection\Projection\ProjectionCriteria; use Patchlevel\EventSourcing\Projection\Projection\Store\InMemoryStore; use Patchlevel\EventSourcing\Projection\Projectionist\DefaultProjectionist; use Patchlevel\EventSourcing\Projection\Projectionist\SyncProjectionistEventBusWrapper; @@ -89,7 +90,7 @@ public function testSuccessful(): void ); $schemaDirector->create(); - $projectionist->boot(); + $projectionist->boot(new ProjectionCriteria(), null, true); $bankAccountId = AccountId::fromString('1'); $bankAccount = BankAccount::create($bankAccountId, 'John'); diff --git a/tests/Integration/BankAccountSplitStream/Projection/BankAccountProjector.php b/tests/Integration/BankAccountSplitStream/Projection/BankAccountProjector.php index 76d435f2c..ba7adb1c1 100644 --- a/tests/Integration/BankAccountSplitStream/Projection/BankAccountProjector.php +++ b/tests/Integration/BankAccountSplitStream/Projection/BankAccountProjector.php @@ -28,8 +28,8 @@ public function __construct( public function create(): void { $table = new Table('projection_bank_account'); - $table->addColumn('id', 'string'); - $table->addColumn('name', 'string'); + $table->addColumn('id', 'string')->setLength(36); + $table->addColumn('name', 'string')->setLength(255); $table->addColumn('balance_in_cents', 'integer'); $table->setPrimaryKey(['id']); diff --git a/tests/Integration/BasicImplementation/BasicIntegrationTest.php b/tests/Integration/BasicImplementation/BasicIntegrationTest.php index dbf5c6b6b..7c70f718d 100644 --- a/tests/Integration/BasicImplementation/BasicIntegrationTest.php +++ b/tests/Integration/BasicImplementation/BasicIntegrationTest.php @@ -8,6 +8,7 @@ use Patchlevel\EventSourcing\EventBus\DefaultEventBus; use Patchlevel\EventSourcing\Metadata\AggregateRoot\AggregateRootRegistry; use Patchlevel\EventSourcing\Metadata\AggregateRoot\AttributeAggregateRootRegistryFactory; +use Patchlevel\EventSourcing\Projection\Projection\ProjectionCriteria; use Patchlevel\EventSourcing\Projection\Projection\Store\InMemoryStore; use Patchlevel\EventSourcing\Projection\Projectionist\DefaultProjectionist; use Patchlevel\EventSourcing\Projection\Projectionist\SyncProjectionistEventBusWrapper; @@ -88,7 +89,7 @@ public function testSuccessful(): void ); $schemaDirector->create(); - $projectionist->boot(); + $projectionist->boot(new ProjectionCriteria(), null, true); $profileId = ProfileId::fromString('1'); $profile = Profile::create($profileId, 'John'); @@ -161,7 +162,7 @@ public function testSnapshot(): void ); $schemaDirector->create(); - $projectionist->boot(); + $projectionist->boot(new ProjectionCriteria(), null, true); $profileId = ProfileId::fromString('1'); $profile = Profile::create($profileId, 'John'); diff --git a/tests/Integration/BasicImplementation/Projection/ProfileProjector.php b/tests/Integration/BasicImplementation/Projection/ProfileProjector.php index ce93fc774..6ec636f85 100644 --- a/tests/Integration/BasicImplementation/Projection/ProfileProjector.php +++ b/tests/Integration/BasicImplementation/Projection/ProfileProjector.php @@ -27,8 +27,8 @@ public function __construct( public function create(): void { $table = new Table('projection_profile'); - $table->addColumn('id', 'string'); - $table->addColumn('name', 'string'); + $table->addColumn('id', 'string')->setLength(36); + $table->addColumn('name', 'string')->setLength(255); $table->setPrimaryKey(['id']); $this->connection->createSchemaManager()->createTable($table); diff --git a/tests/Integration/Outbox/OutboxTest.php b/tests/Integration/Outbox/OutboxTest.php index 7c864e605..9fffcb837 100644 --- a/tests/Integration/Outbox/OutboxTest.php +++ b/tests/Integration/Outbox/OutboxTest.php @@ -11,6 +11,7 @@ use Patchlevel\EventSourcing\Outbox\EventBusPublisher; use Patchlevel\EventSourcing\Outbox\OutboxEventBus; use Patchlevel\EventSourcing\Outbox\StoreOutboxConsumer; +use Patchlevel\EventSourcing\Projection\Projection\ProjectionCriteria; use Patchlevel\EventSourcing\Projection\Projection\Store\InMemoryStore; use Patchlevel\EventSourcing\Projection\Projectionist\DefaultProjectionist; use Patchlevel\EventSourcing\Projection\Projectionist\SyncProjectionistEventBusWrapper; @@ -100,7 +101,7 @@ public function testSuccessful(): void ); $schemaDirector->create(); - $projectionist->boot(); + $projectionist->boot(new ProjectionCriteria(), null, true); $profile = Profile::create(ProfileId::fromString('1'), 'John'); $repository->save($profile); diff --git a/tests/Integration/Outbox/Projection/ProfileProjector.php b/tests/Integration/Outbox/Projection/ProfileProjector.php index 6d8d2f55d..3e28a648c 100644 --- a/tests/Integration/Outbox/Projection/ProfileProjector.php +++ b/tests/Integration/Outbox/Projection/ProfileProjector.php @@ -27,8 +27,8 @@ public function __construct( public function create(): void { $table = new Table('projection_profile'); - $table->addColumn('id', 'string'); - $table->addColumn('name', 'string'); + $table->addColumn('id', 'string')->setLength(36); + $table->addColumn('name', 'string')->setLength(255); $table->setPrimaryKey(['id']); $this->connection->createSchemaManager()->createTable($table); diff --git a/tests/Integration/Projectionist/Projection/ProfileProjector.php b/tests/Integration/Projectionist/Projection/ProfileProjector.php index bd4893b52..7d328ca7d 100644 --- a/tests/Integration/Projectionist/Projection/ProfileProjector.php +++ b/tests/Integration/Projectionist/Projection/ProfileProjector.php @@ -31,8 +31,8 @@ public function __construct( public function create(): void { $table = new Table($this->tableName()); - $table->addColumn('id', 'string'); - $table->addColumn('name', 'string'); + $table->addColumn('id', 'string')->setLength(36); + $table->addColumn('name', 'string')->setLength(255); $table->setPrimaryKey(['id']); $this->connection->createSchemaManager()->createTable($table); diff --git a/tests/Integration/Projectionist/ProjectionistTest.php b/tests/Integration/Projectionist/ProjectionistTest.php index 013791a04..b909c57fc 100644 --- a/tests/Integration/Projectionist/ProjectionistTest.php +++ b/tests/Integration/Projectionist/ProjectionistTest.php @@ -9,6 +9,7 @@ use Patchlevel\EventSourcing\Lock\DoctrineDbalStoreSchemaAdapter; use Patchlevel\EventSourcing\Metadata\AggregateRoot\AggregateRootRegistry; use Patchlevel\EventSourcing\Metadata\AggregateRoot\AttributeAggregateRootRegistryFactory; +use Patchlevel\EventSourcing\Projection\Projection\ProjectionCriteria; use Patchlevel\EventSourcing\Projection\Projection\Store\DoctrineStore; use Patchlevel\EventSourcing\Projection\Projectionist\DefaultProjectionist; use Patchlevel\EventSourcing\Projection\Projectionist\SyncProjectionistEventBusWrapper; @@ -138,12 +139,12 @@ public function testSync(): void $schemaDirector->drop(); $schemaDirector->create(); - $projectionist->boot(); + $projectionist->boot(new ProjectionCriteria(), null, true); $profile = Profile::create(ProfileId::fromString('1'), 'John'); $repository->save($profile); - $projectionist->run(); + $projectionist->run(new ProjectionCriteria(), null, true); $result = $this->connection->fetchAssociative('SELECT * FROM projection_profile_1 WHERE id = ?', ['1']); From f5363200a01d5e3c7cee8f6a8f736c865ff84287 Mon Sep 17 00:00:00 2001 From: David Badura Date: Sun, 4 Feb 2024 13:54:55 +0100 Subject: [PATCH 7/7] skip testArchiveMessages for php 8.1 --- tests/Unit/Store/DoctrineDbalStoreTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Unit/Store/DoctrineDbalStoreTest.php b/tests/Unit/Store/DoctrineDbalStoreTest.php index c5810a7a2..47f7be242 100644 --- a/tests/Unit/Store/DoctrineDbalStoreTest.php +++ b/tests/Unit/Store/DoctrineDbalStoreTest.php @@ -27,6 +27,7 @@ use Patchlevel\EventSourcing\Tests\Unit\Fixture\Profile; use Patchlevel\EventSourcing\Tests\Unit\Fixture\ProfileCreated; use Patchlevel\EventSourcing\Tests\Unit\Fixture\ProfileId; +use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\TestCase; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; @@ -241,6 +242,7 @@ public function testSaveWithOneEvent(): void $singleTableStore->save($message); } + #[RequiresPhp('>= 8.2')] public function testArchiveMessages(): void { $serializer = $this->prophesize(EventSerializer::class);