From 0a8e14bf689fc743b3a10b72846862230b751bff Mon Sep 17 00:00:00 2001 From: Karoly Gossler Date: Fri, 17 Feb 2023 00:31:29 +0100 Subject: [PATCH 1/3] added phpunit support --- .github/workflows/continuous-integration.yml | 6 ++++- .gitignore | 3 +++ composer.json | 11 +++++++- phpunit.xml.dist | 27 ++++++++++++++++++++ tests/bootstrap.php | 17 ++++++++++++ 5 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 phpunit.xml.dist create mode 100644 tests/bootstrap.php diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index a6366b71b..8ca3db465 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -40,6 +40,7 @@ jobs: php-version: "${{ matrix.php-version }}" extensions: apcu ini-values: apc.enable_cli=1 + tools: phpunit:9 - name: Get composer cache directory id: composer-cache @@ -58,5 +59,8 @@ jobs: - name: Run Check configuration run: php data/bin/check_configuration.php - - name: Run Tests + - name: Run Lime Tests run: php data/bin/symfony symfony:test --trace + + - name: Run PHPUnit Tests + run: phpunit diff --git a/.gitignore b/.gitignore index 3c17d4767..0644b20d6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,6 @@ lib/plugins/sfDoctrinePlugin/test/functional/fixtures/log/ /vendor /composer.lock .php-cs-fixer.cache +.phpunit.result.cache +phpunit.xml +/tests/fixtures/symfony/log diff --git a/composer.json b/composer.json index 096711cad..d2f51a21f 100755 --- a/composer.json +++ b/composer.json @@ -8,7 +8,8 @@ "swiftmailer/swiftmailer": "^5.2 || ^6.0" }, "require-dev": { - "psr/log": "*" + "psr/log": "*", + "symfony/phpunit-bridge": "^7.0" }, "autoload": { "files": ["autoload.php"] @@ -26,5 +27,13 @@ "replace": { "lexpress/symfony1": "^1.5" }, + "scripts": { + "test": [ + "@test:lime", + "@test:phpunit" + ], + "test:lime": "php data/bin/symfony symfony:test --trace", + "test:phpunit": "phpunit-9" + }, "bin": ["data/bin/symfony"] } diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 000000000..02172c0a2 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,27 @@ + + + + + + + + + + + + ./tests/ + + + + + + ./lib/ + + + diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 000000000..e4dbb773a --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,17 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Bridge\PhpUnit\DeprecationErrorHandler; + +require_once __DIR__.'/../vendor/autoload.php'; + +if ('disabled' !== getenv('SYMFONY_DEPRECATIONS_HELPER')) { + DeprecationErrorHandler::register(getenv('SYMFONY_DEPRECATIONS_HELPER')); +} From df367c8d1e1c3facc3ff020f4a836ceb609c2b54 Mon Sep 17 00:00:00 2001 From: Karoly Gossler Date: Fri, 16 Feb 2024 09:17:09 +0100 Subject: [PATCH 2/3] added coverage excludes (skeleton files and vendors) --- phpunit.xml.dist | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 02172c0a2..b7e812945 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -23,5 +23,11 @@ ./lib/ + + ./lib/plugins/sfDoctrinePlugin/data/** + ./lib/plugins/sfDoctrinePlugin/lib/vendor/** + ./lib/task/generator/skeleton/** + ./lib/vendor/swiftmailer/** + From 8bcf950f3df4857ff653a5ecf4d89351d87a3c33 Mon Sep 17 00:00:00 2001 From: Karoly Gossler Date: Sat, 24 Feb 2024 12:02:46 +0100 Subject: [PATCH 3/3] added phive config --- .gitattributes | 1 + .gitignore | 3 +++ .phive/phars.dist.xml | 4 ++++ composer.json | 2 +- 4 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .phive/phars.dist.xml diff --git a/.gitattributes b/.gitattributes index 9645b77e9..a2588e4f6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9,3 +9,4 @@ docker-compose.yml export-ignore phpstan.neon export-ignore phpunit.xml export-ignore tests/ export-ignore +.phive/ export-ignore diff --git a/.gitignore b/.gitignore index 0644b20d6..ac969d60a 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,6 @@ lib/plugins/sfDoctrinePlugin/test/functional/fixtures/log/ .phpunit.result.cache phpunit.xml /tests/fixtures/symfony/log + +.phive/phars.xml +bin/phpunit diff --git a/.phive/phars.dist.xml b/.phive/phars.dist.xml new file mode 100644 index 000000000..bc7aaf399 --- /dev/null +++ b/.phive/phars.dist.xml @@ -0,0 +1,4 @@ + + + + diff --git a/composer.json b/composer.json index d2f51a21f..85c4a0b94 100755 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ "@test:phpunit" ], "test:lime": "php data/bin/symfony symfony:test --trace", - "test:phpunit": "phpunit-9" + "test:phpunit": "./bin/phpunit" }, "bin": ["data/bin/symfony"] }