Tests

Testing

The tests shipping with wCMF are based on PHPUnit. They are located in the src/wcmf/test directory.

Running tests

Before running the tests the code generator is used to generate the environment:

$ cd src/wcmf/test/model & ant

To run all tests, execute the following command in the src/wcmf/test directory:

$ phpunit --bootstrap bootstrap.php --configuration configuration.xml

The tests use PHP's built-in web server where necessary and operate on a file based database (SQLite).

Writing tests

To simplify setting up the testing enviroment, wCMF provides the TestUtil class. It has methods for starting the test server, initializing the framework, starting sessions and simulating requests.

For developing custom test cases, the following base classes may be used: