Commit 23e0bc20 authored by Fabrice Gangler's avatar Fabrice Gangler 🎨
Browse files

TEST: customize the Bootstrap Process before Running Tests

Added "clear your cache before running those tests"

documentation:
https://symfony.com/doc/current/testing/bootstrap.html

Refs: #14
parent 9bd66882
......@@ -13,6 +13,7 @@
<server name="SHELL_VERBOSITY" value="-1" />
<server name="SYMFONY_PHPUNIT_REMOVE" value="" />
<server name="SYMFONY_PHPUNIT_VERSION" value="7.5" />
<env name="BOOTSTRAP_CLEAR_CACHE_ENV" value="test"/>
</php>
<testsuites>
......
......@@ -4,6 +4,17 @@ use Symfony\Component\Dotenv\Dotenv;
require dirname(__DIR__).'/vendor/autoload.php';
// Clearing the cache for the test environment
if (isset($_ENV['BOOTSTRAP_CLEAR_CACHE_ENV'])) {
// executes the "php bin/console cache:clear" command
passthru(sprintf(
'APP_ENV=%s php "%s/../bin/console" cache:clear --no-warmup',
$_ENV['BOOTSTRAP_CLEAR_CACHE_ENV'],
__DIR__
));
}
if (file_exists(dirname(__DIR__).'/config/bootstrap.php')) {
require dirname(__DIR__).'/config/bootstrap.php';
} elseif (method_exists(Dotenv::class, 'bootEnv')) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment