JavaScript Editor Javascript validator     Web page editor 

Unit test configuration

Every now and then your unit tests depend on external services - be it a database or LDAP server or a company's web service. Access to those services and servers require creditentials, be it username and password combinations or API keys.

Such confidential information may often not be distributed, and your unit tests should not have them coded into. Instead a separate config file template, config.php.dist, should be shipped. To run the tests, the user creates a copy of that configuration template, saves it as config.php and adjusts it.

You should not die() if no config file is found but let the unit test continue gracefully - this is important in combined suites, when several packages are unit tested in a row.

Instead, you should check if it exists first:

JavaScript Editor Javascript validator     Web page editor