@@ -6,40 +6,47 @@ 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- To do this, first add the following file::
9+ To do this, first add a file that executes your bootstrap work ::
1010
11- // tests. bootstrap.php
11+ // tests/ bootstrap.php
1212 if (isset($_ENV['BOOTSTRAP_CLEAR_CACHE_ENV'])) {
13+ // executes the "php bin/console cache:clear" command
1314 passthru(sprintf(
14- 'php "%s/bin/console" cache:clear --env=%s --no-warmup',
15+ 'php "%s/../ bin/console" cache:clear --env=%s --no-warmup',
1516 __DIR__,
1617 $_ENV['BOOTSTRAP_CLEAR_CACHE_ENV']
1718 ));
1819 }
1920
20- require __DIR__ . ' /vendor/autoload.php';
21+ require __DIR__.'/.. /vendor/autoload.php';
2122
22- Replace the test bootstrap file `` autoload.php `` in `` phpunit.xml.dist ``
23- with `` tests.bootstrap.php `` :
23+ Then, configure `` phpunit.xml.dist `` to execute this `` bootstra.php `` file
24+ before running the tests:
2425
2526.. code-block :: xml
2627
2728 <!-- phpunit.xml.dist -->
28-
29- <!-- ... -->
29+ <?xml version =" 1.0" encoding =" UTF-8" ?>
3030 <phpunit
31- bootstrap = " tests. bootstrap.php"
31+ bootstrap = " tests/ bootstrap.php"
3232 >
33+ <!-- ... -->
34+ </phpunit >
3335
3436 Now, you can define in your ``phpunit.xml.dist `` file which environment you want the
3537cache to be cleared:
3638
3739.. code-block :: xml
3840
3941 <!-- phpunit.xml.dist -->
40- <php >
41- <env name =" BOOTSTRAP_CLEAR_CACHE_ENV" value =" test" />
42- </php >
42+ <?xml version =" 1.0" encoding =" UTF-8" ?>
43+ <phpunit >
44+ <!-- ... -->
45+
46+ <php >
47+ <env name =" BOOTSTRAP_CLEAR_CACHE_ENV" value =" test" />
48+ </php >
49+ </phpunit >
4350
4451 This now becomes an environment variable (i.e. ``$_ENV ``) that's available
4552in the custom bootstrap file (``tests.bootstrap.php ``).
0 commit comments