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 adds support for components that keep state that must be cleared… (#4924)
* This adds support for components that keep state that must be cleared between requests
* Fixed issue in test skip logic + nitpick CS
* Fix application reset after exception
* Add configuration option to recreate the whole application before each request
* Add default configuration
Copy file name to clipboardExpand all lines: src/Codeception/Module/Yii2.php
+9-2Lines changed: 9 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,7 @@
23
23
* ## Application state during testing
24
24
* This section details what you can expect when using this module.
25
25
* * You will get a fresh application in `\Yii::$app` at the start of each test (available in the test and in `_before()`).
26
+
* * Inside your test you may change application state; however these changes will be lost when doing a request if you have enabled `recreateApplication`.
26
27
* * When executing a request via one of the request functions the `request` and `response` component are both recreated.
27
28
* * After a request the whole application is available for inspection / interaction.
28
29
* * You may use multiple database connections, each will use a separate transaction; to prevent accidental mistakes we
@@ -41,8 +42,12 @@
41
42
* Between test casesthe whole application is always recreated
42
43
* * `requestCleanMethod` - (default: recreate) Method for cleaning the request object. Note that this is only for multiple requests inside a single test case.
43
44
* Between test cases the whole application is always recreated
45
+
* * `recreateComponents` - (default: []) Some components change their state making them unsuitable for processing multiple requests. In production this is usually
46
+
* 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.
47
+
* As a consequence, any components specified here should not be changed inside a test since those changes will get regarded.
48
+
* You can use this module by setting params in your functional.suite.yml:
49
+
* * `recreateApplication` - (default: false) whether to recreate the whole application before each request
44
50
* You can use this module by setting params in your functional.suite.yml:
0 commit comments