I am working on some Unit Tests for an API using Codeception. The idea is to make sure that each API call returns the expected response codes and a JSON object in a desired format.
The problem that I have is that I need to use different URLs depending on whether the server is localhost
, the test server or the production one.
I can't use the values of $_SERVER['SERVER_NAME']
because the tests are not ran through the web browser.
Here http://codeception.com/docs/07-AdvancedUsage#Environments they explain that some environments can be set by modifying the configuration file. The documentation doesn't explain how to modify the configuration file to use it within your own unit tests.
Id like to set some environments like local
, test
, production
and then, inside my unit test classes, to know what URLs
to use. Each environment would have different URLs.
I've read the documentation but I can't find the way to do it.
Do you know any way to achieve what I need?