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 are provided:
BaseTestCase
is used as base class for all test cases. It initializes the framework before each test.DatabaseTestCase
adds database support for testing persistency related functionality.ControllerTestCase
adds a convenience method for running requests.SeleniumTestCase
is used to run tests with Selenium.