Setting up unit and functional tests in okapi
externals (requires okapi 1.1.7+)
rake
in the project root directory create a textfile "Rakefile" with the following content
in the project root create the directory "tests" and inside that directory create a "unit" and "functional" directory
in project root call the rake shell command
create a unit test (tests/unit/myfirsttest.php)
create a functional tests (tests/functional/myFirstFunctionalTest.php)
Additional information
- Note that all tests are run on the CLI. This means that SESSION are not available for example and that depending on how PHP is setup a different php.ini will be used. In order to mock aspects or to handle differences between the normal and the testing setup, okapi is called with the environment set to "test". So for example this can be used to set the configuration to use a mock'ed auth container instead of the production one.
- The default functional testing is tightly coupled to XML. You will have to at least overwrite the loadResponse() method as well as the openInBrowser() method if you are not operating on XML DOM.
- Note that an Exception (Test cases run: 2/4, Passes: 50, Failures: 0, Exceptions: 1) indicates an unsuppressed warning/notice etc.
Add Comment