xref: /dokuwiki/_test/README (revision 42dcf8b19dfef94b81a71813ce58e6a0b0026cb1)
1*42dcf8b1SAndreas Gohr====== DokuWiki Test Suite ======
2f8369d7dSTobias Sarnowski
3*42dcf8b1SAndreas GohrThis is the test suit to automatically test various parts of DokuWiki.
4f8369d7dSTobias Sarnowski
5*42dcf8b1SAndreas Gohr===== Requirements =====
6*42dcf8b1SAndreas Gohr
7*42dcf8b1SAndreas Gohr  * PHPUnit 3.6.10+ http://www.phpunit.de/
8*42dcf8b1SAndreas Gohr  * PHP 5.3+ http://www.php.net
9*42dcf8b1SAndreas Gohr
10*42dcf8b1SAndreas Gohr===== PHPUnit Installation ======
11*42dcf8b1SAndreas Gohr
12*42dcf8b1SAndreas Gohrvia PEAR:
13*42dcf8b1SAndreas Gohr
14*42dcf8b1SAndreas Gohr  pear config-set auto_discover 1
15*42dcf8b1SAndreas Gohr  pear upgrade
16*42dcf8b1SAndreas Gohr  pear install pear.phpunit.de/PHPUnit
17*42dcf8b1SAndreas Gohr
18*42dcf8b1SAndreas Gohron Windows:
19*42dcf8b1SAndreas Gohr
20*42dcf8b1SAndreas Gohr  FIXME
21f8369d7dSTobias Sarnowski
22f8369d7dSTobias Sarnowski
23*42dcf8b1SAndreas Gohr===== Running all Tests =====
24f8369d7dSTobias Sarnowski
25*42dcf8b1SAndreas GohrJust change to the ''_test'' directory and run phpunit:
26f8369d7dSTobias Sarnowski
27*42dcf8b1SAndreas Gohr  cd _testing/
28*42dcf8b1SAndreas Gohr  phpunit
29f8369d7dSTobias Sarnowski
30*42dcf8b1SAndreas GohrPHPUnit will fail on some systems with a //headers already sent// error.
31*42dcf8b1SAndreas GohrThis is a known problem with PHPUnit, the error can be avoided by passing the
32*42dcf8b1SAndreas Gohr'--stderr' flag to phpunit:
33f8369d7dSTobias Sarnowski
34*42dcf8b1SAndreas Gohr  phpunit --stderr
35f8369d7dSTobias Sarnowski
36*42dcf8b1SAndreas Gohr===== Running selected Tests =====
37f8369d7dSTobias Sarnowski
38*42dcf8b1SAndreas GohrYou can run a single test file by providing it as an argument to phpunit:
39f8369d7dSTobias Sarnowski
40*42dcf8b1SAndreas Gohr  phpunit --stderr tests/inc/common_cleanText.test.php
41f8369d7dSTobias Sarnowski
42*42dcf8b1SAndreas GohrFIXME add info about test groups.
43f8369d7dSTobias Sarnowski
44*42dcf8b1SAndreas Gohr===== Create new Tests =====
45f8369d7dSTobias Sarnowski
46f8369d7dSTobias SarnowskiTo create a test for DokuWiki, create a *.test.php file within the tests/
47f8369d7dSTobias Sarnowskifolder. Please respect the folder structure and naming convention. Inside the
48f8369d7dSTobias Sarnowskifile, implement a class, extending 'DokuWikiTest'. Every method, starting
49f8369d7dSTobias Sarnowskiwith 'test' will be called as a test (e.g. 'testIfThisIsValid');
50f8369d7dSTobias Sarnowski
51f8369d7dSTobias Sarnowski
52*42dcf8b1SAndreas Gohr===== TODO for the test framework =====
53f8369d7dSTobias Sarnowski
54f8369d7dSTobias Sarnowski  * test cross platform compatibility: especially test windows
55f8369d7dSTobias Sarnowski  * update http://www.dokuwiki.org/devel:unittesting
56f8369d7dSTobias Sarnowski  * optional: add helper methods to TestRequest for easy form submission
57f8369d7dSTobias Sarnowski    * createForm(), ...
58*42dcf8b1SAndreas Gohr  * check PHP Unit test_helpers https://github.com/sebastianbergmann/php-test-helpers
59f8369d7dSTobias Sarnowski
60f8369d7dSTobias Sarnowski
61*42dcf8b1SAndreas Gohr===== Migration Protocol =====
62f8369d7dSTobias Sarnowski
63f8369d7dSTobias SarnowskiThe following tests were not migrated:
64f8369d7dSTobias Sarnowski
65f8369d7dSTobias Sarnowski  * inc/indexer_idx_indexlengths (fs dependencies)
66f8369d7dSTobias Sarnowski  * inc/mail_send (integration test)
67f8369d7dSTobias Sarnowski  * inc/parser/parser_formatting
68f8369d7dSTobias Sarnowski  * inc/parser/xhtml_htmlphp (runkit)
69f8369d7dSTobias Sarnowski  * inc/parser/xhtml_links
70f8369d7dSTobias Sarnowski
71