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:
BaseTestCaseis used as base class for all test cases. It initializes the framework before each test.DatabaseTestCaseadds database support for testing persistency related functionality.ControllerTestCaseadds a convenience method for running requests.SeleniumTestCaseis used to run tests with Selenium.