File tree Expand file tree Collapse file tree 3 files changed +16
-33
lines changed Expand file tree Collapse file tree 3 files changed +16
-33
lines changed Original file line number Diff line number Diff line change @@ -161,15 +161,15 @@ As an example, a test could look like this::
161161 To run your functional tests, the ``WebTestCase `` class needs to know which
162162 is the application kernel to bootstrap it. The kernel class is usually
163163 defined in the ``KERNEL_CLASS `` environment variable (included in the
164- default ``phpunit .xml- dist `` file provided by Symfony):
164+ default ``phpunit.xml. dist `` file provided by Symfony):
165165
166166 .. code-block :: xml
167167
168168 <?xml version =" 1.0" charset =" utf-8" ?>
169169 <phpunit >
170170 <php >
171171 <!-- the value is the FQCN of the application kernel -->
172- <server name =" KERNEL_CLASS" value =" App\Kernel" />
172+ <env name =" KERNEL_CLASS" value =" App\Kernel" />
173173 </php >
174174 <!-- ... -->
175175 </phpunit >
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ To do this, first add a file that executes your bootstrap work::
2020
2121 require __DIR__.'/../vendor/autoload.php';
2222
23- Then, configure ``phpunit.xml.dist `` to execute this ``bootstra .php `` file
23+ Then, configure ``phpunit.xml.dist `` to execute this ``bootstrap .php `` file
2424before running the tests:
2525
2626.. code-block :: xml
Original file line number Diff line number Diff line change @@ -112,33 +112,16 @@ Most of the time you want to use a dedicated database connection to make sure
112112not to overwrite data you entered when developing the application and also
113113to be able to clear the database before every test.
114114
115- To do this, you can specify a database configuration which overwrites the default
116- configuration just in the ``test `` environment:
117-
118- .. configuration-block ::
119-
120- .. code-block :: yaml
121-
122- # config/packages/test/doctrine.yaml
123- doctrine :
124- # ...
125- dbal :
126- url : ' mysql://USERNAME:PASSWORD@127.0.0.1/DB_NAME?charset=utf8mb4&serverVersion=5.7'
127-
128- .. code-block :: xml
129-
130- <!-- config/packages/test/doctrine.xml -->
131- <doctrine : config >
132- <doctrine : dbal
133- url =" mysql://USERNAME:PASSWORD@127.0.0.1/DB_NAME?charset=utf8mb4& serverVersion=5.7"
134- />
135- </doctrine : config >
136-
137- .. code-block :: php
138-
139- // config/packages/test/doctrine.php
140- $container->loadFromExtension('doctrine', array(
141- 'dbal' => array(
142- 'url' => 'mysql://USERNAME:PASSWORD@127.0.0.1/DB_NAME?charset=utf8mb4&serverVersion=5.7',
143- ),
144- ));
115+ To do this, you can override the value of the ``DATABASE_URL `` env var in the
116+ ``phpunit.xml.dist `` to use a diferent database for your tests:
117+
118+ .. code-block :: xml
119+
120+ <?xml version =" 1.0" charset =" utf-8" ?>
121+ <phpunit >
122+ <php >
123+ <!-- the value is the Doctrine connection string in DSN format -->
124+ <env name =" DATABASE_URL" value =" mysql://USERNAME:PASSWORD@127.0.0.1/DB_NAME?charset=utf8mb4& serverVersion=5.7" />
125+ </php >
126+ <!-- ... -->
127+ </phpunit >
You can’t perform that action at this time.
0 commit comments