diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..a296d41 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,41 @@ +name: PHP CI + +on: + push: + branches: + - master + pull_request: + +jobs: + unit-tests: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + tools: phpunit + - name: Validate composer.json and composer.lock + run: composer validate + - name: Install dependencies + run: composer install + - name: Run tests + run: ./vendor/bin/phpunit tests + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + tools: phpcbf + - name: Validate composer.json and composer.lock + run: composer validate + - name: Install dependencies + run: composer install + - name: Lint code + run: ./vendor/bin/phpcbf -n src diff --git a/composer.json b/composer.json index 08e27d3..b56fdec 100644 --- a/composer.json +++ b/composer.json @@ -8,6 +8,7 @@ "symfony/cache": "^7" }, "require-dev": { - "phpunit/phpunit": "^11" + "phpunit/phpunit": "^11", + "squizlabs/php_codesniffer": "^3" } } diff --git a/composer.lock b/composer.lock index 609a82e..de8029a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8e56efd7f495e99b7f1955d0cf20c31b", + "content-hash": "6e0163d31d45627ec744ec1e4d3c6e13", "packages": [ { "name": "doctrine/collections", - "version": "2.1.4", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/collections.git", - "reference": "72328a11443a0de79967104ad36ba7b30bded134" + "reference": "07e16cd7b80a2cffed99e36b541876af172f0257" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/collections/zipball/72328a11443a0de79967104ad36ba7b30bded134", - "reference": "72328a11443a0de79967104ad36ba7b30bded134", + "url": "https://api.github.com/repos/doctrine/collections/zipball/07e16cd7b80a2cffed99e36b541876af172f0257", + "reference": "07e16cd7b80a2cffed99e36b541876af172f0257", "shasum": "" }, "require": { @@ -29,7 +29,7 @@ "ext-json": "*", "phpstan/phpstan": "^1.8", "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^9.5", + "phpunit/phpunit": "^10.5", "vimeo/psalm": "^5.11" }, "type": "library", @@ -74,7 +74,7 @@ ], "support": { "issues": "https://github.com/doctrine/collections/issues", - "source": "https://github.com/doctrine/collections/tree/2.1.4" + "source": "https://github.com/doctrine/collections/tree/2.2.0" }, "funding": [ { @@ -90,7 +90,7 @@ "type": "tidelift" } ], - "time": "2023-10-03T09:22:33+00:00" + "time": "2024-02-25T22:55:36+00:00" }, { "name": "doctrine/dbal", @@ -578,16 +578,16 @@ }, { "name": "doctrine/orm", - "version": "3.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/doctrine/orm.git", - "reference": "2a250b5814de192a23438c0a43e15da7e77890a7" + "reference": "b8d0a85017374165d8f8c0855e9eb18806b25d32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/orm/zipball/2a250b5814de192a23438c0a43e15da7e77890a7", - "reference": "2a250b5814de192a23438c0a43e15da7e77890a7", + "url": "https://api.github.com/repos/doctrine/orm/zipball/b8d0a85017374165d8f8c0855e9eb18806b25d32", + "reference": "b8d0a85017374165d8f8c0855e9eb18806b25d32", "shasum": "" }, "require": { @@ -609,12 +609,12 @@ "require-dev": { "doctrine/coding-standard": "^12.0", "phpbench/phpbench": "^1.0", - "phpstan/phpstan": "1.10.35", + "phpstan/phpstan": "1.10.59", "phpunit/phpunit": "^10.4.0", "psr/log": "^1 || ^2 || ^3", "squizlabs/php_codesniffer": "3.7.2", "symfony/cache": "^5.4 || ^6.2 || ^7.0", - "vimeo/psalm": "5.16.0" + "vimeo/psalm": "5.22.2" }, "suggest": { "ext-dom": "Provides support for XSD validation for XML mapping files", @@ -660,22 +660,22 @@ ], "support": { "issues": "https://github.com/doctrine/orm/issues", - "source": "https://github.com/doctrine/orm/tree/3.0.1" + "source": "https://github.com/doctrine/orm/tree/3.0.2" }, - "time": "2024-02-22T12:23:53+00:00" + "time": "2024-03-01T09:51:50+00:00" }, { "name": "doctrine/persistence", - "version": "3.2.0", + "version": "3.3.1", "source": { "type": "git", "url": "https://github.com/doctrine/persistence.git", - "reference": "63fee8c33bef740db6730eb2a750cd3da6495603" + "reference": "b6fd1f126b13c1f7e7321f7338b14a19116b5de4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/persistence/zipball/63fee8c33bef740db6730eb2a750cd3da6495603", - "reference": "63fee8c33bef740db6730eb2a750cd3da6495603", + "url": "https://api.github.com/repos/doctrine/persistence/zipball/b6fd1f126b13c1f7e7321f7338b14a19116b5de4", + "reference": "b6fd1f126b13c1f7e7321f7338b14a19116b5de4", "shasum": "" }, "require": { @@ -744,7 +744,7 @@ ], "support": { "issues": "https://github.com/doctrine/persistence/issues", - "source": "https://github.com/doctrine/persistence/tree/3.2.0" + "source": "https://github.com/doctrine/persistence/tree/3.3.1" }, "funding": [ { @@ -760,7 +760,7 @@ "type": "tidelift" } ], - "time": "2023-05-17T18:32:04+00:00" + "time": "2024-03-01T19:53:13+00:00" }, { "name": "psr/cache", @@ -916,16 +916,16 @@ }, { "name": "symfony/cache", - "version": "v7.0.3", + "version": "v7.0.4", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "2207eceb2433d74df81232d97439bf508cb9e050" + "reference": "fc822951dd360a593224bb2cef90a087d0dff60f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/2207eceb2433d74df81232d97439bf508cb9e050", - "reference": "2207eceb2433d74df81232d97439bf508cb9e050", + "url": "https://api.github.com/repos/symfony/cache/zipball/fc822951dd360a593224bb2cef90a087d0dff60f", + "reference": "fc822951dd360a593224bb2cef90a087d0dff60f", "shasum": "" }, "require": { @@ -992,7 +992,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v7.0.3" + "source": "https://github.com/symfony/cache/tree/v7.0.4" }, "funding": [ { @@ -1008,7 +1008,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T15:02:46+00:00" + "time": "2024-02-22T20:27:20+00:00" }, { "name": "symfony/cache-contracts", @@ -1088,16 +1088,16 @@ }, { "name": "symfony/console", - "version": "v7.0.3", + "version": "v7.0.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "c5010d50f1ee4b25cfa0201d9915cf1b14071456" + "reference": "6b099f3306f7c9c2d2786ed736d0026b2903205f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/c5010d50f1ee4b25cfa0201d9915cf1b14071456", - "reference": "c5010d50f1ee4b25cfa0201d9915cf1b14071456", + "url": "https://api.github.com/repos/symfony/console/zipball/6b099f3306f7c9c2d2786ed736d0026b2903205f", + "reference": "6b099f3306f7c9c2d2786ed736d0026b2903205f", "shasum": "" }, "require": { @@ -1161,7 +1161,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.0.3" + "source": "https://github.com/symfony/console/tree/v7.0.4" }, "funding": [ { @@ -1177,7 +1177,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T15:02:46+00:00" + "time": "2024-02-22T20:27:20+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1581,16 +1581,16 @@ }, { "name": "symfony/string", - "version": "v7.0.3", + "version": "v7.0.4", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "524aac4a280b90a4420d8d6a040718d0586505ac" + "reference": "f5832521b998b0bec40bee688ad5de98d4cf111b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/524aac4a280b90a4420d8d6a040718d0586505ac", - "reference": "524aac4a280b90a4420d8d6a040718d0586505ac", + "url": "https://api.github.com/repos/symfony/string/zipball/f5832521b998b0bec40bee688ad5de98d4cf111b", + "reference": "f5832521b998b0bec40bee688ad5de98d4cf111b", "shasum": "" }, "require": { @@ -1647,7 +1647,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.0.3" + "source": "https://github.com/symfony/string/tree/v7.0.4" }, "funding": [ { @@ -1663,20 +1663,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T15:41:16+00:00" + "time": "2024-02-01T13:17:36+00:00" }, { "name": "symfony/var-exporter", - "version": "v7.0.3", + "version": "v7.0.4", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "1fb79308cb5fc2b44bff6e8af10a5af6812e05b8" + "reference": "dfb0acb6803eb714f05d97dd4c5abe6d5fa9fe41" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/1fb79308cb5fc2b44bff6e8af10a5af6812e05b8", - "reference": "1fb79308cb5fc2b44bff6e8af10a5af6812e05b8", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/dfb0acb6803eb714f05d97dd4c5abe6d5fa9fe41", + "reference": "dfb0acb6803eb714f05d97dd4c5abe6d5fa9fe41", "shasum": "" }, "require": { @@ -1721,7 +1721,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v7.0.3" + "source": "https://github.com/symfony/var-exporter/tree/v7.0.4" }, "funding": [ { @@ -1737,7 +1737,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T15:02:46+00:00" + "time": "2024-02-26T10:35:24+00:00" } ], "packages-dev": [ @@ -1971,16 +1971,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "11.0.0", + "version": "11.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "5e238e4b982cb272bf9faeee6f33af83d465d0e2" + "reference": "89702be0ad026873ef3a1605fe8726254eef4e2c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/5e238e4b982cb272bf9faeee6f33af83d465d0e2", - "reference": "5e238e4b982cb272bf9faeee6f33af83d465d0e2", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/89702be0ad026873ef3a1605fe8726254eef4e2c", + "reference": "89702be0ad026873ef3a1605fe8726254eef4e2c", "shasum": "" }, "require": { @@ -2037,7 +2037,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.0" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.1" }, "funding": [ { @@ -2045,7 +2045,7 @@ "type": "github" } ], - "time": "2024-02-02T06:03:46+00:00" + "time": "2024-03-02T07:34:25+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2294,16 +2294,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.0.3", + "version": "11.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "de24e7e7c67fbf437f7b6cd7bc919f2dc6fd89d4" + "reference": "3f4261269c91370e9b2b3f64cc76c617c442c35a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/de24e7e7c67fbf437f7b6cd7bc919f2dc6fd89d4", - "reference": "de24e7e7c67fbf437f7b6cd7bc919f2dc6fd89d4", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3f4261269c91370e9b2b3f64cc76c617c442c35a", + "reference": "3f4261269c91370e9b2b3f64cc76c617c442c35a", "shasum": "" }, "require": { @@ -2374,7 +2374,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.0.3" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.0.4" }, "funding": [ { @@ -2390,20 +2390,20 @@ "type": "tidelift" } ], - "time": "2024-02-10T06:31:16+00:00" + "time": "2024-02-29T16:21:10+00:00" }, { "name": "sebastian/cli-parser", - "version": "3.0.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "efd6ce5bb8131fe981e2f879dbd47605fbe0cc6f" + "reference": "00a74d5568694711f0222e54fb281e1d15fdf04a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/efd6ce5bb8131fe981e2f879dbd47605fbe0cc6f", - "reference": "efd6ce5bb8131fe981e2f879dbd47605fbe0cc6f", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/00a74d5568694711f0222e54fb281e1d15fdf04a", + "reference": "00a74d5568694711f0222e54fb281e1d15fdf04a", "shasum": "" }, "require": { @@ -2439,7 +2439,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/3.0.0" + "source": "https://github.com/sebastianbergmann/cli-parser/tree/3.0.1" }, "funding": [ { @@ -2447,7 +2447,7 @@ "type": "github" } ], - "time": "2024-02-02T05:48:04+00:00" + "time": "2024-03-02T07:26:58+00:00" }, { "name": "sebastian/code-unit", @@ -2699,16 +2699,16 @@ }, { "name": "sebastian/diff", - "version": "6.0.0", + "version": "6.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3e3f502419518897a923aa1c64d51f9def2e0aff" + "reference": "ab83243ecc233de5655b76f577711de9f842e712" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3e3f502419518897a923aa1c64d51f9def2e0aff", - "reference": "3e3f502419518897a923aa1c64d51f9def2e0aff", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ab83243ecc233de5655b76f577711de9f842e712", + "reference": "ab83243ecc233de5655b76f577711de9f842e712", "shasum": "" }, "require": { @@ -2754,7 +2754,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", "security": "https://github.com/sebastianbergmann/diff/security/policy", - "source": "https://github.com/sebastianbergmann/diff/tree/6.0.0" + "source": "https://github.com/sebastianbergmann/diff/tree/6.0.1" }, "funding": [ { @@ -2762,7 +2762,7 @@ "type": "github" } ], - "time": "2024-02-02T05:56:35+00:00" + "time": "2024-03-02T07:30:33+00:00" }, { "name": "sebastian/environment", @@ -2830,16 +2830,16 @@ }, { "name": "sebastian/exporter", - "version": "6.0.0", + "version": "6.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "d0c0a93fc746b0c066037f1e7d09104129e868ff" + "reference": "f291e5a317c321c0381fa9ecc796fa2d21b186da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/d0c0a93fc746b0c066037f1e7d09104129e868ff", - "reference": "d0c0a93fc746b0c066037f1e7d09104129e868ff", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/f291e5a317c321c0381fa9ecc796fa2d21b186da", + "reference": "f291e5a317c321c0381fa9ecc796fa2d21b186da", "shasum": "" }, "require": { @@ -2896,7 +2896,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", "security": "https://github.com/sebastianbergmann/exporter/security/policy", - "source": "https://github.com/sebastianbergmann/exporter/tree/6.0.0" + "source": "https://github.com/sebastianbergmann/exporter/tree/6.0.1" }, "funding": [ { @@ -2904,20 +2904,20 @@ "type": "github" } ], - "time": "2024-02-02T05:58:52+00:00" + "time": "2024-03-02T07:28:20+00:00" }, { "name": "sebastian/global-state", - "version": "7.0.0", + "version": "7.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "590e7cbc6565fa2e26c3df4e629a34bb0bc00c17" + "reference": "c3a307e832f2e69c7ef869e31fc644fde0e7cb3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/590e7cbc6565fa2e26c3df4e629a34bb0bc00c17", - "reference": "590e7cbc6565fa2e26c3df4e629a34bb0bc00c17", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c3a307e832f2e69c7ef869e31fc644fde0e7cb3e", + "reference": "c3a307e832f2e69c7ef869e31fc644fde0e7cb3e", "shasum": "" }, "require": { @@ -2958,7 +2958,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", "security": "https://github.com/sebastianbergmann/global-state/security/policy", - "source": "https://github.com/sebastianbergmann/global-state/tree/7.0.0" + "source": "https://github.com/sebastianbergmann/global-state/tree/7.0.1" }, "funding": [ { @@ -2966,7 +2966,7 @@ "type": "github" } ], - "time": "2024-02-02T05:59:33+00:00" + "time": "2024-03-02T07:32:10+00:00" }, { "name": "sebastian/lines-of-code", @@ -3315,6 +3315,86 @@ ], "time": "2024-02-02T06:10:47+00:00" }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.9.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/d63cee4890a8afaf86a22e51ad4d97c91dd4579b", + "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" + }, + "bin": [ + "bin/phpcbf", + "bin/phpcs" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-02-16T15:06:51+00:00" + }, { "name": "theseer/tokenizer", "version": "1.2.2", diff --git a/src/LoadEntities.php b/src/LoadEntities.php index 1cdde06..1f9267f 100644 --- a/src/LoadEntities.php +++ b/src/LoadEntities.php @@ -5,7 +5,7 @@ use Doctrine\DBAL\Platforms\MySQLPlatform; use Doctrine\ORM\ORMSetup; use Doctrine\ORM\Tools\SchemaTool; -use Doctrine\DBAL\Schema\PostgreSqlSchemaManager; +use Doctrine\DBAL\Schema\PostgreSQLSchemaManager; use Doctrine\ORM\EntityManager; use Doctrine\DBAL\Connection; use Doctrine\DBAL\Schema\AbstractSchemaManager; @@ -56,7 +56,7 @@ public function getCurrentDriver(): string -class MockPostgreSqlSchemaManager extends PostgreSqlSchemaManager +class MockPostgreSQLSchemaManager extends PostgreSQLSchemaManager { public function determineCurrentSchema(): string { @@ -73,7 +73,7 @@ public function createSchemaManager(): AbstractSchemaManager $dialects = DialectsMapping::getInstance()->getDialects(); $driver = DialectsMapping::getInstance()->getCurrentDriver(); if ($driver === $dialects['postgres']) { - return new MockPostgreSqlSchemaManager($this, $this->getDatabasePlatform()); + return new MockPostgreSQLSchemaManager($this, $this->getDatabasePlatform()); } return parent::createSchemaManager(); } @@ -121,9 +121,11 @@ function DumpDDL(array $paths, string $dialect): string $driver = $dialects[$dialect]; DialectsMapping::getInstance()->setCurrentDriver($driver); - $connection = DriverManager::getConnection([ + $connection = DriverManager::getConnection( + [ 'driver' => $driver, - ], $config); + ], $config + ); $entityManager = new MockEntityManager($connection, $config); $metadatas = $entityManager->getMetadataFactory()->getAllMetadata(); diff --git a/tests/LoadEntitiesTest.php b/tests/LoadEntitiesTest.php index c944a1c..6debfbb 100644 --- a/tests/LoadEntitiesTest.php +++ b/tests/LoadEntitiesTest.php @@ -11,8 +11,8 @@ public function testDumpDDLMySQL(): void { $path = __DIR__ . "/entities"; $result = DumpDDL([$path], "mysql"); - $expected = 'CREATE TABLE users (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)); -CREATE TABLE bugs (id INT AUTO_INCREMENT NOT NULL, description VARCHAR(255) NOT NULL, created DATETIME NOT NULL, status VARCHAR(255) NOT NULL, engineer_id INT DEFAULT NULL, reporter_id INT DEFAULT NULL, INDEX IDX_1E197C9F8D8CDF1 (engineer_id), INDEX IDX_1E197C9E1CFE6F5 (reporter_id), PRIMARY KEY(id)); + $expected = 'CREATE TABLE bugs (id INT AUTO_INCREMENT NOT NULL, description VARCHAR(255) NOT NULL, created DATETIME NOT NULL, status VARCHAR(255) NOT NULL, engineer_id INT DEFAULT NULL, reporter_id INT DEFAULT NULL, INDEX IDX_1E197C9F8D8CDF1 (engineer_id), INDEX IDX_1E197C9E1CFE6F5 (reporter_id), PRIMARY KEY(id)); +CREATE TABLE users (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)); ALTER TABLE bugs ADD CONSTRAINT FK_1E197C9F8D8CDF1 FOREIGN KEY (engineer_id) REFERENCES users (id); ALTER TABLE bugs ADD CONSTRAINT FK_1E197C9E1CFE6F5 FOREIGN KEY (reporter_id) REFERENCES users (id);'; $this->assertEquals($expected, $result); @@ -22,10 +22,10 @@ public function testDumpDDLPostgres(): void { $path = __DIR__ . "/entities"; $result = DumpDDL([$path], "postgres"); - $expected = 'CREATE TABLE users (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)); -CREATE TABLE bugs (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, description VARCHAR(255) NOT NULL, created TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, status VARCHAR(255) NOT NULL, engineer_id INT DEFAULT NULL, reporter_id INT DEFAULT NULL, PRIMARY KEY(id)); + $expected = 'CREATE TABLE bugs (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, description VARCHAR(255) NOT NULL, created TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, status VARCHAR(255) NOT NULL, engineer_id INT DEFAULT NULL, reporter_id INT DEFAULT NULL, PRIMARY KEY(id)); CREATE INDEX IDX_1E197C9F8D8CDF1 ON bugs (engineer_id); CREATE INDEX IDX_1E197C9E1CFE6F5 ON bugs (reporter_id); +CREATE TABLE users (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)); ALTER TABLE bugs ADD CONSTRAINT FK_1E197C9F8D8CDF1 FOREIGN KEY (engineer_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE; ALTER TABLE bugs ADD CONSTRAINT FK_1E197C9E1CFE6F5 FOREIGN KEY (reporter_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE;'; $this->assertEquals($expected, $result);