Toggle navigation
wCMF 4.0
Guides
Getting started
Architecture
Model
Persistence
Presentation
Configuration
Security
I18n & l10n
Tests
API
Code
Support
wcmf_older
wcmf
docs
api-src
framework_description
en
test.doxy
1
/*!
2
\page tests Tests
3
<div class="has-toc"></div>
4
5
# Testing # {#testing}
6
7
The tests shipping with wCMF are based on [PHPUnit](https://phpunit.de/). They
8
are located in the _src/wcmf/test_ directory.
9
10
## Running tests ## {#testing_run}
11
12
Before running the tests the code generator is used to generate the environment:
13
14
~~~~~~~~~~~~~
15
$ cd src/wcmf/test/model & ant
16
~~~~~~~~~~~~~
17
18
To run all tests, execute the following command in the _src/wcmf/test_ directory:
19
20
~~~~~~~~~~~~~
21
$ phpunit --bootstrap bootstrap.php --configuration configuration.xml
22
~~~~~~~~~~~~~
23
24
The tests use PHP's built-in web server where necessary and operate on a file
25
based database ([SQLite](https://www.sqlite.org/)).
26
27
## Writing tests ## {#testing_write}
28
29
To simplify setting up the testing enviroment, wCMF provides the
30
\link wcmf::lib::util::TestUtil `TestUtil`\endlink class. It has methods for
31
starting the test server, initializing the framework, starting sessions and
32
simulating requests.
33
34
For developing custom test cases, the following base classes may be used:
35
36
- \link wcmf::test::lib::BaseTestCase `BaseTestCase`\endlink is used as
37
base class for all test cases. It initializes the framework before each test.
38
- \link wcmf::test::lib::DatabaseTestCase `DatabaseTestCase`\endlink adds
39
database support for testing persistency related functionality.
40
- \link wcmf::test::lib::ControllerTestCase `ControllerTestCase`\endlink
41
adds a convenience method for running requests.
42
- \link wcmf::test::lib::SeleniumTestCase `SeleniumTestCase`\endlink is used to
43
run tests with [Selenium](http://www.seleniumhq.org/).
44
*/