diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f54084c2..ea2fe4d8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -65,4 +65,4 @@ jobs: run: vendor/bin/phpstan analyse - name: Run PHPUnit - run: vendor/bin/phpunit + run: bin/phpunit diff --git a/.gitignore b/.gitignore index e41b44fc..9c3c9cee 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,8 @@ composer.lock /phpunit.xml .phpunit.result.cache ###< phpunit/phpunit ### + +###> symfony/phpunit-bridge ### +.phpunit.result.cache +/phpunit.xml +###< symfony/phpunit-bridge ### diff --git a/bin/phpunit b/bin/phpunit new file mode 100755 index 00000000..692baccb --- /dev/null +++ b/bin/phpunit @@ -0,0 +1,23 @@ +#!/usr/bin/env php += 80000) { + require dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit'; + } else { + define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php'); + require PHPUNIT_COMPOSER_INSTALL; + PHPUnit\TextUI\Command::main(); + } +} else { + if (!is_file(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) { + echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n"; + exit(1); + } + + require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php'; +} diff --git a/composer.json b/composer.json index 5d6dbacd..629861ef 100644 --- a/composer.json +++ b/composer.json @@ -34,6 +34,7 @@ "symfony/dotenv": "^5.4 || ^6.0", "symfony/flex": "^2.4", "symfony/framework-bundle": "^5.4 || ^6.0", + "symfony/phpunit-bridge": "^5.4 || ^6.0", "symfony/runtime": "^5.4 || ^6.0", "symfony/translation": "^5.4 || ^6.0", "symfony/twig-bundle": "^5.4 || ^6.0", @@ -62,6 +63,7 @@ "allow-plugins": { "symfony/flex": true, "symfony/runtime": true - } + }, + "sort-packages": true } } diff --git a/monorepo-builder.php b/monorepo-builder.php index 71b93388..7d8f853b 100644 --- a/monorepo-builder.php +++ b/monorepo-builder.php @@ -14,6 +14,7 @@ ComposerJsonSection::REQUIRE_DEV => [ 'phpstan/phpstan' => '^1.10', 'symfony/flex' => '^2.4', + 'symfony/phpunit-bridge' => '^5.4 || ^6.0', 'symplify/monorepo-builder' => '11.2.*', 'phpstan/phpstan-symfony' => '^1.3' ], diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 00000000..50ce9883 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + src/TwigHooks/tests + + + + + + + + + + diff --git a/symfony.lock b/symfony.lock index 5e287af6..6e47a47c 100644 --- a/symfony.lock +++ b/symfony.lock @@ -65,6 +65,21 @@ "src/Kernel.php" ] }, + "symfony/phpunit-bridge": { + "version": "7.0", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "6.3", + "ref": "1f5830c331065b6e4c9d5fa2105e322d29fcd573" + }, + "files": [ + ".env.test", + "bin/phpunit", + "phpunit.xml.dist", + "tests/bootstrap.php" + ] + }, "symfony/routing": { "version": "5.4", "recipe": {