xref: /dokuwiki/_test/README (revision e8b5a4f91c8a6e230a6cfe13c43dc9ddce31e253)
1====== DokuWiki Test Suite ======
2
3This is the test suit to automatically test various parts of DokuWiki.
4
5===== Requirements =====
6
7  * PHPUnit 3.6.10+ http://www.phpunit.de/
8  * PHP 5.3+ http://www.php.net
9
10===== PHPUnit Installation ======
11
12via PEAR:
13
14  pear config-set auto_discover 1
15  pear upgrade
16  pear install pear.phpunit.de/PHPUnit
17
18on Windows:
19
20  FIXME
21
22
23===== Running all Tests =====
24
25Just change to the ''_test'' directory and run phpunit:
26
27  cd _testing/
28  phpunit
29
30PHPUnit will fail on some systems with a //headers already sent// error.
31This is a known problem with PHPUnit, the error can be avoided by passing the
32'--stderr' flag to phpunit:
33
34  phpunit --stderr
35
36On windows you may have to enable OpenSSL support for https tests.
37Some of them point to httpclient_http.tests.php on the failure.
38To enable HTTPS support copy the ''libeay32.dll'' and ''ssleay32.dll'' to your ''windows\system32'' folder
39and add the following line to your php.ini in the extension section:
40<code ini>
41extension=php_openssl.dll
42</code>
43
44===== Running selected Tests =====
45
46You can run a single test file by providing it as an argument to phpunit:
47
48  phpunit --stderr tests/inc/common_cleanText.test.php
49
50You can also use groups to exclude certain test from running. For example use
51the following command to avoid long running test or tests accessing the
52Internet.
53
54  phpunit --stderr --exclude-group slow,internet
55
56===== Create new Tests =====
57
58To create a test for DokuWiki, create a *.test.php file within the tests/
59folder. Please respect the folder structure and naming convention. Inside the
60file, implement a class, extending 'DokuWikiTest'. Every method, starting
61with 'test' will be called as a test (e.g. 'testIfThisIsValid');
62
63
64===== TODO for the test framework =====
65
66  * test cross platform compatibility: especially test windows
67  * update http://www.dokuwiki.org/devel:unittesting
68  * optional: add helper methods to TestRequest for easy form submission
69    * createForm(), ...
70  * check PHP Unit test_helpers https://github.com/sebastianbergmann/php-test-helpers
71
72
73===== Migration Protocol =====
74
75The following tests were not migrated:
76
77  * inc/indexer_idx_indexlengths (fs dependencies)
78  * inc/mail_send (integration test)
79  * inc/parser/parser_formatting
80  * inc/parser/xhtml_htmlphp (runkit)
81  * inc/parser/xhtml_links
82
83