File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -6,20 +6,20 @@ running those tests. For example, if you're running a functional test and
66have introduced a new translation resource, then you will need to clear your
77cache before running those tests.
88
9- Symfony already created the following ``tests/bootstrap.php `` file when installing
10- the package to work with tests. If you don't have this file, create it::
9+ To do this, first add a file that executes your bootstrap work::
1110
1211 // tests/bootstrap.php
13- use Symfony\Component\Dotenv\Dotenv;
14-
15- require dirname(__DIR__).'/vendor/autoload.php';
16-
17- if (file_exists(dirname(__DIR__).'/config/bootstrap.php')) {
18- require dirname(__DIR__).'/config/bootstrap.php';
19- } elseif (method_exists(Dotenv::class, 'bootEnv')) {
20- (new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
12+ if (isset($_ENV['BOOTSTRAP_CLEAR_CACHE_ENV'])) {
13+ // executes the "php bin/console cache:clear" command
14+ passthru(sprintf(
15+ 'APP_ENV=%s php "%s/../bin/console" cache:clear --no-warmup',
16+ $_ENV['BOOTSTRAP_CLEAR_CACHE_ENV'],
17+ __DIR__
18+ ));
2119 }
2220
21+ require __DIR__.'/../config/bootstrap.php';
22+
2323Then, check that your ``phpunit.xml.dist `` file runs this ``bootstrap.php `` file
2424before running the tests:
2525
You can’t perform that action at this time.
0 commit comments