Skip to content

Fix wrong env variable name #18619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 6 additions & 27 deletions testing/bootstrap.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ You can modify this file to add custom logic:
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
}

+ 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__
+ ));
+ }
+ // executes the "php bin/console cache:clear" command
+ passthru(sprintf(
+ 'APP_ENV=%s php "%s/../bin/console" cache:clear --no-warmup',
+ $_ENV['APP_ENV'],
+ __DIR__
+ ));

.. note::

Expand All @@ -48,22 +46,3 @@ You can modify this file to add custom logic:
>
<!-- ... -->
</phpunit>

Now, you can update the ``phpunit.xml.dist`` file to declare the custom
environment variable introduced to ``tests/bootstrap.php``:

.. code-block:: xml

<!-- phpunit.xml.dist -->
<?xml version="1.0" encoding="UTF-8" ?>
<phpunit>
<php>
<env name="BOOTSTRAP_CLEAR_CACHE_ENV" value="test"/>
<!-- ... -->
</php>

<!-- ... -->
</phpunit>

Now, when running ``vendor/bin/phpunit``, the cache will be cleared
automatically by the bootstrap file before running all tests.