feat(test): apply new recipe for phpunit

This commit is contained in:
Simon Vieille 2023-01-08 19:09:12 +01:00
parent e232e44dcd
commit 7397a1cde8
Signed by: deblan
GPG key ID: 579388D585F70417
5 changed files with 29 additions and 18 deletions

1
.gitignore vendored
View file

@ -12,7 +12,6 @@
###< symfony/framework-bundle ### ###< symfony/framework-bundle ###
###> symfony/phpunit-bridge ### ###> symfony/phpunit-bridge ###
.phpunit
.phpunit.result.cache .phpunit.result.cache
/phpunit.xml /phpunit.xml
###< symfony/phpunit-bridge ### ###< symfony/phpunit-bridge ###

View file

@ -1,13 +1,19 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
if (!file_exists(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) { if (!ini_get('date.timezone')) {
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n"; ini_set('date.timezone', 'UTC');
exit(1);
} }
if (false === getenv('SYMFONY_PHPUNIT_DIR')) { if (is_file(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit')) {
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit'); 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'; require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
}

View file

@ -2,17 +2,19 @@
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html --> <!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="bin/.phpunit/phpunit.xsd" xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false" backupGlobals="false"
colors="true" colors="true"
bootstrap="tests/bootstrap.php" bootstrap="tests/bootstrap.php"
convertDeprecationsToExceptions="false"
> >
<php> <php>
<ini name="display_errors" value="1" />
<ini name="error_reporting" value="-1" /> <ini name="error_reporting" value="-1" />
<server name="APP_ENV" value="test" force="true" /> <server name="APP_ENV" value="test" force="true" />
<server name="SHELL_VERBOSITY" value="-1" /> <server name="SHELL_VERBOSITY" value="-1" />
<server name="SYMFONY_PHPUNIT_REMOVE" value="" /> <server name="SYMFONY_PHPUNIT_REMOVE" value="" />
<server name="SYMFONY_PHPUNIT_VERSION" value="8.5" /> <server name="SYMFONY_PHPUNIT_VERSION" value="9.5" />
</php> </php>
<testsuites> <testsuites>
@ -21,11 +23,11 @@
</testsuite> </testsuite>
</testsuites> </testsuites>
<filter> <coverage processUncoveredFiles="true">
<whitelist processUncoveredFilesFromWhitelist="true"> <include>
<directory suffix=".php">src</directory> <directory suffix=".php">src</directory>
</whitelist> </include>
</filter> </coverage>
<listeners> <listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" /> <listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />

View file

@ -487,12 +487,12 @@
"version": "v6.0.2" "version": "v6.0.2"
}, },
"symfony/phpunit-bridge": { "symfony/phpunit-bridge": {
"version": "5.1", "version": "6.2",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes", "repo": "github.com/symfony/recipes",
"branch": "master", "branch": "main",
"version": "5.1", "version": "5.3",
"ref": "bf16921ef8309a81d9f046e9b6369c46bcbd031f" "ref": "819d3d2ffa4590eba0b8f4f3e5e89415ee4e45c3"
}, },
"files": [ "files": [
".env.test", ".env.test",

View file

@ -9,3 +9,7 @@ if (file_exists(dirname(__DIR__).'/config/bootstrap.php')) {
} elseif (method_exists(Dotenv::class, 'bootEnv')) { } elseif (method_exists(Dotenv::class, 'bootEnv')) {
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env'); (new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
} }
if ($_SERVER['APP_DEBUG']) {
umask(0000);
}