You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: for/yii.md
+35-6Lines changed: 35 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -207,12 +207,37 @@ Tests also include namespaces for testcase classes and testers to avoid conflict
207
207
Learn more about <a href="http://codeception.com/docs/08-Customization#One-Runner-for-Multiple-Applications">testing multiple applications »</a>
208
208
</div>
209
209
210
-
## Configuration
210
+
## Manual Setup && Configuration
211
211
212
-
It is important to understand how Yii2 module is configured to run the application. The only required parameter for Yii2 is `configFile`. This file with configuration for test environment of Yii application. It should be stored merge original application config overriding `id` value and provide different database for testing:
212
+
213
+
To start you need to install Codeception via Composer
214
+
215
+
```
216
+
composer require "codeception/codecepton" --dev
217
+
```
218
+
219
+
Create basic test suites
220
+
221
+
```
222
+
composer exec codecept bootstrap
223
+
```
224
+
225
+
Enable module Yii2 for functional tests inside `functional.suite.yml`:
226
+
227
+
```yml
228
+
# fucntional.suite.yml
229
+
modules:
230
+
enabled:
231
+
- Yii2:
232
+
configFile: #insert path to config file
233
+
```
234
+
235
+
236
+
The only required parameter for Yii2 module is `configFile`. This file with configuration for test configuration of Yii application. It should merge original application config overriding `id` value and provide different database for testing:
It is important to override database configuration so running tests won't affect your development or production database. Test config is recommended to store in `config` folder of application. A relative path to it from `codeception.yml` is required. In basic and advanced applications `configFile` is defined in global configuration file:
256
+
Test config is recommended to store in `config` folder of application. You should provide path to test config relatively to `codeception.yml` file.
257
+
258
+
Please also make sure that `YII_ENV` constant is set to `test` as it is done in `tests/_bootstrap.php` file of basic and advanced app templates.
259
+
260
+
Once you configured functional tests it should be easy to create setup for unit and acceptance tests, as it is described in this guide.
261
+
262
+
In basic and advanced application templates `configFile` is defined in global configuration file:
232
263
233
264
```yml
234
265
# inside codeception.yml
@@ -238,6 +269,4 @@ modules:
238
269
configFile: 'config/test.php'
239
270
```
240
271
241
-
This way we don't need to provide test config for each defined suite.
242
-
243
-
Please also make sure that `YII_ENV` constant is set to `test` as it is done in `tests/_bootstrap.php` file of basic and advanced app templates.
272
+
This way we don't need to provide test config for each defined suite.
0 commit comments