summaryrefslogtreecommitdiff
path: root/_test/README
blob: 5220248b2d5933a5dd7c91818bc87ed6b2a10a72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
====== DokuWiki Test Suite ======

This is the test suite to automatically test various parts of DokuWiki.

===== Requirements =====

  * PHPUnit 3.6.10+ http://www.phpunit.de/
  * PHP 5.3+ http://www.php.net

===== PHPUnit Installation ======

==== via PEAR installer ====

  pear config-set auto_discover 1
  pear install pear.phpunit.de/PHPUnit

==== via Composer ====

Include a composer.json file in your project, which can be as minimal as:

<code>
{
    "require-dev": {
        "phpunit/phpunit": "3.7.*"
    }
}
</code>

==== via PHP archive (PHAR) ====

Download http://pear.phpunit.de/get/phpunit.phar and make it executable on your system.


===== Running all tests =====

Just change to the ''_test'' directory and run phpunit:

  cd _test/
  phpunit

PHPUnit will fail on some systems with a //headers already sent// error.
This is a known problem with PHPUnit, the error can be avoided by passing the
'--stderr' flag to phpunit:

  phpunit --stderr

On windows you may have to enable OpenSSL support for https tests.
Some of them point to httpclient_http.tests.php on the failure.
To enable HTTPS support copy the ''libeay32.dll'' and ''ssleay32.dll'' to your ''windows\system32'' folder
and add the following line to your php.ini in the extension section:
<code ini>
extension=php_openssl.dll
</code>

===== Running selected Tests =====

You can run a single test file by providing it as an argument to phpunit:

  phpunit --stderr tests/inc/common_cleanText.test.php

You can also use groups to exclude certain test from running. For example use
the following command to avoid long running test or tests accessing the
Internet.

  phpunit --stderr --exclude-group slow,internet

===== Create new Tests =====

To create a test for DokuWiki, create a *.test.php file within the tests/
folder. Please respect the folder structure and naming convention. Inside the
file, implement a class, extending 'DokuWikiTest'. Every method, starting
with 'test' will be called as a test (e.g. 'testIfThisIsValid');


===== TODO for the test framework =====

  * test cross platform compatibility: especially test windows
  * update http://www.dokuwiki.org/devel:unittesting
  * optional: add helper methods to TestRequest for easy form submission
    * createForm(), ...
  * check PHP Unit test_helpers https://github.com/sebastianbergmann/php-test-helpers


===== Migration Protocol =====

The following tests were not migrated:

  * inc/indexer_idx_indexlengths (fs dependencies)
  * inc/mail_send (integration test)
  * inc/parser/parser_formatting
  * inc/parser/xhtml_htmlphp (runkit)
  * inc/parser/xhtml_links