summaryrefslogtreecommitdiff
path: root/_testing/README
blob: 32f2a93b58a6c6c63d7fc8ce82c6e60ba8afb650 (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
DokuWiki Test Suite
=============================================================================

Content of this document:

  * Requirements
  * Installation of PHPUnit via Pear
  * Running all Tests
  * Create new Tests
  * Known Bad Tests
  * TODO for test framework



Requirements
-----------------------------------------------------------------------------

  * PHP Unit 3.7


Installation of PHPUnit via Pear
-----------------------------------------------------------------------------

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


Running all Tests
-----------------------------------------------------------------------------

  > cd _testing/
  > phpunit


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');


Known Bad Tests
-----------------------------------------------------------------------------

Every test should be green on every run but the following were broken after
the PHPUnit migration and are disabled by default:

  * inc/DifferenceEngine (removed FS#2161, FS#2223)
  * inc/html_hilight (runkit)
  * inc/indexer_idx_indexlengths (fs dependencies)
  * inc/mail_send (integration test)
  * inc/parser/parser_formatting
  * inc/parser/xhtml_htmlphp (runkit)
  * inc/parser/xhtml_links


TODO for the test framework
-----------------------------------------------------------------------------

  * following use cases should be possible:
    * dw core
      * unit test [ok]
      * integration test [ok]
    * plugins
      * unit test
      * integration test [untested]
  * provide the possibility to enable/disable plugins
  * cleanup dw globals like registered event hooks
  * cross platform compatibility: especially test windows (hint: tmp dir location)
  * update http://www.dokuwiki.org/devel:unittesting
  * optional: add helper methods to TestRequest for easy form submission
    * createForm(), ...
  * optional: add helper methods to TestReponse for easy response parsing
    * findElementById, findElementByXPath, ...