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
* This module provides integration with [Yii framework](http://www.yiiframework.com/) (2.0).
23
-
* It initializes Yii framework in test environment and provides actions for functional testing.
23
+
*
24
+
* It initializes the Yii framework in a test environment and provides actions
25
+
* for functional testing.
26
+
*
24
27
* ## Application state during testing
28
+
*
25
29
* This section details what you can expect when using this module.
26
-
* * You will get a fresh application in `\Yii::$app` at the start of each test (available in the test and in `_before()`).
27
-
* * Inside your test you may change application state; however these changes will be lost when doing a request if you have enabled `recreateApplication`.
28
-
* * When executing a request via one of the request functions the `request` and `response` component are both recreated.
29
-
* * After a request the whole application is available for inspection / interaction.
30
-
* * You may use multiple database connections, each will use a separate transaction; to prevent accidental mistakes we
31
-
* will warn you if you try to connect to the same database twice but we cannot reuse the same connection.
30
+
*
31
+
* * You will get a fresh application in `\Yii::$app` at the start of each test
32
+
* (available in the test and in `_before()`).
33
+
* * Inside your test you may change application state; however these changes
34
+
* will be lost when doing a request if you have enabled `recreateApplication`.
35
+
* * When executing a request via one of the request functions the `request`
36
+
* and `response` component are both recreated.
37
+
* * After a request the whole application is available for inspection /
38
+
* interaction.
39
+
* * You may use multiple database connections, each will use a separate
40
+
* transaction; to prevent accidental mistakes we will warn you if you try to
41
+
* connect to the same database twice but we cannot reuse the same connection.
32
42
*
33
43
* ## Config
34
44
*
35
-
* * `configFile` *required* - the path to the application config file. File should be configured for test environment and return configuration array.
45
+
* * `configFile` *required* - path to the application config file. The file
46
+
* should be configured for the test environment and return a configuration
* * `entryScript` - front script title (like: index-test.php). If not set - taken from entryUrl.
38
-
* * `transaction` - (default: true) wrap all database connection inside a transaction and roll it back after the test. Should be disabled for acceptance testing..
39
-
* * `cleanup` - (default: true) cleanup fixtures after the test
40
-
* * `ignoreCollidingDSN` - (default: false) When 2 database connections use the same DSN but different settings an exception will be thrown, set this to true to disable this behavior.
41
-
* * `fixturesMethod` - (default: _fixtures) Name of the method used for creating fixtures.
42
-
* * `responseCleanMethod` - (default: clear) Method for cleaning the response object. Note that this is only for multiple requests inside a single test case.
43
-
* Between test casesthe whole application is always recreated
44
-
* * `requestCleanMethod` - (default: recreate) Method for cleaning the request object. Note that this is only for multiple requests inside a single test case.
45
-
* Between test cases the whole application is always recreated
46
-
* * `recreateComponents` - (default: []) Some components change their state making them unsuitable for processing multiple requests. In production this is usually
47
-
* not a problem since web apps tend to die and start over after each request. This allows you to list application components that need to be recreated before each request.
48
-
* As a consequence, any components specified here should not be changed inside a test since those changes will get regarded.
49
-
* * `recreateApplication` - (default: false) whether to recreate the whole application before each request
50
-
* * `closeSessionOnRecreateApplication` - (default: true) whether to close the session in between requests inside a single test,
51
-
* * if recreateApplication is set to true
52
-
* You can use this module by setting params in your functional.suite.yml:
49
+
* * `entryScript` - front script title (like: index-test.php). If not set it's
50
+
* taken from `entryUrl`.
51
+
* * `transaction` - (default: `true`) wrap all database connection inside a
52
+
* transaction and roll it back after the test. Should be disabled for
53
+
* acceptance testing.
54
+
* * `cleanup` - (default: `true`) cleanup fixtures after the test
55
+
* * `ignoreCollidingDSN` - (default: `false`) When 2 database connections use
56
+
* the same DSN but different settings an exception will be thrown. Set this to
57
+
* true to disable this behavior.
58
+
* * `fixturesMethod` - (default: `_fixtures`) Name of the method used for
59
+
* creating fixtures.
60
+
* * `responseCleanMethod` - (default: `clear`) Method for cleaning the
61
+
* response object. Note that this is only for multiple requests inside a
62
+
* single test case. Between test cases the whole application is always
63
+
* recreated.
64
+
* * `requestCleanMethod` - (default: `recreate`) Method for cleaning the
65
+
* request object. Note that this is only for multiple requests inside a single
66
+
* test case. Between test cases the whole application is always recreated.
67
+
* * `recreateComponents` - (default: `[]`) Some components change their state
68
+
* making them unsuitable for processing multiple requests. In production
69
+
* this is usually not a problem since web apps tend to die and start over
70
+
* after each request. This allows you to list application components that
71
+
* need to be recreated before each request. As a consequence, any
72
+
* components specified here should not be changed inside a test since those
73
+
* changes will get discarded.
74
+
* * `recreateApplication` - (default: `false`) whether to recreate the whole
75
+
* application before each request
76
+
*
77
+
* You can use this module by setting params in your `functional.suite.yml`:
78
+
*
53
79
* ```yaml
54
80
* actor: FunctionalTester
55
81
* modules:
@@ -60,9 +86,11 @@
60
86
*
61
87
* ### Parts
62
88
*
63
-
* By default all available methods are loaded, but you can specify parts to select only needed actions and avoid conflicts.
89
+
* By default all available methods are loaded, but you can also use the `part`
90
+
* option to select only the needed actions and to avoid conflicts. The
91
+
* avilable parts are:
64
92
*
65
-
* * `init` - use module only for initialization (for acceptance tests).
93
+
* * `init` - use the module only for initialization (for acceptance tests).
66
94
* * `orm` - include only `haveRecord/grabRecord/seeRecord/dontSeeRecord` actions.
67
95
* * `fixtures` - use fixtures inside tests with `haveFixtures/grabFixture/grabFixtures` actions.
68
96
* * `email` - include email actions `seeEmailsIsSent/grabLastSentEmail/...`
@@ -100,24 +128,26 @@
100
128
* browser: firefox
101
129
* - Yii2:
102
130
* configFile: 'config/test.php'
103
-
* part: ORM # allow to use AR methods
131
+
* part: orm # allow to use AR methods
104
132
* transaction: false # don't wrap test in transaction
105
133
* cleanup: false # don't cleanup the fixtures
106
134
* entryScript: index-test.php
107
135
* ```
108
136
*
109
137
* ## Fixtures
110
138
*
111
-
* This module allows to use [fixtures](http://www.yiiframework.com/doc-2.0/guide-test-fixtures.html) inside a test. There are two options for that.
112
-
* Fixtures can be loaded using [haveFixtures](#haveFixtures) method inside a test:
0 commit comments