Merge pull request #3969 from dokuwiki-translate/lang_update_635_1684167422
[dokuwiki.git] / _test / README
blob161877270a7ff03440454822f3a785d655c3df52
1 ====== DokuWiki Test Suite ======
3 This is the test suite to automatically test various parts of DokuWiki.
5 ===== Requirements =====
7   * PHPUnit 3.6.10+ http://www.phpunit.de/
8   * PHP 5.3+ http://php.net
10 ===== PHPUnit Installation ======
12 You can install phpunit through your distribution's package manager or simply
13 download the newest phar file into the _test directory:
15   cd _test/
16   wget https://phar.phpunit.de/phpunit.phar
19 ===== Running all tests =====
21 Just change to the ''_test'' directory and run phpunit (depending on your install
22 method):
24   cd _test/
25   phpunit
29   cd _test/
30   php phpunit.phar
32 ===== Troubleshooting =====
34 PHPUnit will fail on some systems with a //headers already sent// error.
35 This is a known problem with PHPUnit, the error can be avoided by passing the
36 '--stderr' flag to phpunit:
38   phpunit --stderr
40 On windows you may have to enable OpenSSL support for https tests.
41 Some of them point to httpclient_http.tests.php on the failure.
42 To enable HTTPS support copy the ''libeay32.dll'' and ''ssleay32.dll''
43 to your ''windows\system32'' folder and add the following line to your php.ini
44 in the extension section:
46 <code ini>
47 extension=php_openssl.dll
48 </code>
50 ===== Running selected Tests =====
52 You can run a single test file by providing it as an argument to phpunit:
54   phpunit tests/inc/common_cleanText.test.php
56 You can also use groups to exclude certain test from running. For example use
57 the following command to avoid long running test or tests accessing the
58 Internet.
60   phpunit --exclude-group slow,internet
62 ===== Create new Tests =====
64 To create a test for DokuWiki, create a *.test.php file within the tests/
65 folder. Please respect the folder structure and naming convention. Inside the
66 file, implement a class, extending 'DokuWikiTest'. Every method, starting
67 with 'test' will be called as a test (e.g. 'testIfThisIsValid');
69 ===== TODO for the test framework =====
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