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 36===== Running selected Tests ===== 37 38You can run a single test file by providing it as an argument to phpunit: 39 40 phpunit --stderr tests/inc/common_cleanText.test.php 41 42You can also use groups to exclude certain test from running. For example use 43the following command to avoid long running test or tests accessing the 44Internet. 45 46 phpunit --stderr --exclude-group slow,internet 47 48===== Create new Tests ===== 49 50To create a test for DokuWiki, create a *.test.php file within the tests/ 51folder. Please respect the folder structure and naming convention. Inside the 52file, implement a class, extending 'DokuWikiTest'. Every method, starting 53with 'test' will be called as a test (e.g. 'testIfThisIsValid'); 54 55 56===== TODO for the test framework ===== 57 58 * test cross platform compatibility: especially test windows 59 * update http://www.dokuwiki.org/devel:unittesting 60 * optional: add helper methods to TestRequest for easy form submission 61 * createForm(), ... 62 * check PHP Unit test_helpers https://github.com/sebastianbergmann/php-test-helpers 63 64 65===== Migration Protocol ===== 66 67The following tests were not migrated: 68 69 * inc/indexer_idx_indexlengths (fs dependencies) 70 * inc/mail_send (integration test) 71 * inc/parser/parser_formatting 72 * inc/parser/xhtml_htmlphp (runkit) 73 * inc/parser/xhtml_links 74 75