File tree 1 file changed +10
-10
lines changed
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
6
6
have introduced a new translation resource, then you will need to clear your
7
7
cache before running those tests.
8
8
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::
11
10
12
11
// 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
+ ));
21
19
}
22
20
21
+ require __DIR__.'/../config/bootstrap.php';
22
+
23
23
Then, check that your ``phpunit.xml.dist `` file runs this ``bootstrap.php `` file
24
24
before running the tests:
25
25
You can’t perform that action at this time.
0 commit comments