1====== DokuWiki Test Suite ====== 2 3This is the test suite 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 12You can install phpunit through your distribution's package manager or simply 13download the newest phar file into the _test directory: 14 15 cd _test/ 16 wget https://phar.phpunit.de/phpunit.phar 17 18 19===== Running all tests ===== 20 21Just change to the ''_test'' directory and run phpunit (depending on your install 22method): 23 24 cd _test/ 25 phpunit 26 27or 28 29 cd _test/ 30 php phpunit.phar 31 32===== Troubleshooting ===== 33 34PHPUnit will fail on some systems with a //headers already sent// error. 35This is a known problem with PHPUnit, the error can be avoided by passing the 36'--stderr' flag to phpunit: 37 38 phpunit --stderr 39 40On windows you may have to enable OpenSSL support for https tests. 41Some of them point to httpclient_http.tests.php on the failure. 42To enable HTTPS support copy the ''libeay32.dll'' and ''ssleay32.dll'' 43to your ''windows\system32'' folder and add the following line to your php.ini 44in the extension section: 45 46<code ini> 47extension=php_openssl.dll 48</code> 49 50===== Running selected Tests ===== 51 52You can run a single test file by providing it as an argument to phpunit: 53 54 phpunit tests/inc/common_cleanText.test.php 55 56You can also use groups to exclude certain test from running. For example use 57the following command to avoid long running test or tests accessing the 58Internet. 59 60 phpunit --exclude-group slow,internet 61 62===== Create new Tests ===== 63 64To create a test for DokuWiki, create a *.test.php file within the tests/ 65folder. Please respect the folder structure and naming convention. Inside the 66file, implement a class, extending 'DokuWikiTest'. Every method, starting 67with 'test' will be called as a test (e.g. 'testIfThisIsValid'); 68 69===== TODO for the test framework ===== 70 71 * optional: add helper methods to TestRequest for easy form submission 72 * createForm(), ... 73 * check PHP Unit test_helpers https://github.com/sebastianbergmann/php-test-helpers 74 75 76