Skip to content

Commit 763ac34

Browse files
Added a section on Setting Environment variables
Mostly because I had to do this to get things working :)
1 parent 6190786 commit 763ac34

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

for/wordpress.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ If you did not use the step-by-step initialization then edit each suite configur
5454
If you are using the `WPLoader` module in your tests take care to create a dedicated database for it and not to use the same database the `Db` or `WPDb` modules might use.
5555
The use of the modules defined in the WPBrowser package is not tied to this bootstrap though so feel free to set up Codeception in any other way.
5656

57+
## Setting Environment variables
58+
If you have used the initialization template, you'll need to set Codeception to [load parameters](https://codeception.com/docs/06-ModulesAndHelpers#dynamic-configuration-with-parameters) from the environment variables. You can do this by updating the `params` key in your codeception.dist.yaml to
59+
```
60+
params:
61+
- env # load params from environment vars
62+
```
63+
This will load the environment variables from the `.env.testing` file.
64+
5765
## Integration Tests
5866
Commonly "WordPress unit tests" (hence the `wpunit` default name of the suite) are not related to classical unit tests but to integration tests. The difference is that unit tests are supposed to test a class methods in complete isolation, while integration tests check how components work inside WordPress. That's why, to prepare WordPress for testing, you should enable `WPLoader` module into `wpunit.suite.yml`.
5967
The `WPLoader` module: it takes care of loading, installing and configuring a fresh WordPress installation before each test method runs.

0 commit comments

Comments
 (0)