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::
161
161
To run your functional tests, the ``WebTestCase `` class needs to know which
162
162
is the application kernel to bootstrap it. The kernel class is usually
163
163
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):
165
165
166
166
.. code-block :: xml
167
167
168
168
<?xml version =" 1.0" charset =" utf-8" ?>
169
169
<phpunit >
170
170
<php >
171
171
<!-- 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" />
173
173
</php >
174
174
<!-- ... -->
175
175
</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::
20
20
21
21
require __DIR__.'/../vendor/autoload.php';
22
22
23
- Then, configure ``phpunit.xml.dist `` to execute this ``bootstra .php `` file
23
+ Then, configure ``phpunit.xml.dist `` to execute this ``bootstrap .php `` file
24
24
before running the tests:
25
25
26
26
.. 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
112
112
not to overwrite data you entered when developing the application and also
113
113
to be able to clear the database before every test.
114
114
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