]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - tests/unit/readme.html
Add translation for TextFormattingRules
[SourceForge/phpwiki.git] / tests / unit / readme.html
1 <html>
2 <head>
3 <title>PhpWiki unit tests</title>
4 </head>
5 <body>
6
7 <h1>Introduction</h1>
8
9 This directory contains unit tests for PhpWiki.  You must have <a
10 href="http://pear.php.net/package/PHPUnit">PEAR's PHPUnit package</a>.
11 These tests are unrelated to maketest.pl in the directory above this
12 one, which do not use PHPUnit.
13
14 <h1>Prerequisites</h1>
15 <h2>PHP</h2>
16
17 You might want to run these from the php <a
18 href="http://www.php.net/features.commandline">command-line
19 interface</a>.  It was experimental as of PHP 4.2.0 (php-cli), default as of PHP
20 4.3.0.
21
22 You also need the 'pear' executable to install or update the required pear libraries.
23
24 <h2>PHPUnit</h2>
25
26 You can use pear to see if PHPUnit is installed:
27
28 <pre>
29 /export/scratch/apache/2.0.46/php/bin) % ./pear list
30 Installed packages:
31 ===================
32 Package        Version State
33 Archive_Tar    0.9     stable
34 Console_Getopt 1.0     stable
35 DB             1.3     stable
36 HTTP           1.2     stable
37 HTTP_Upload    0.8.1   stable
38 Mail           1.0.1   stable
39 Net_SMTP       1.0     stable
40 Net_Socket     1.0.1   stable
41 PEAR           1.1     stable
42 PHPUnit        1.0.0   stable
43 XML_Parser     1.0.1   stable
44 XML_RPC        1.0.4   stable
45 </pre>
46
47 If it is not installed, you can use 'pear' to install it:
48
49 <pre>
50 /export/scratch/apache/2.0.46/php/bin) % ./pear install PHPUnit
51 </pre>
52
53 <h1>Running these unit tests</h1>
54
55 You must be in the phpwiki/tests/unit subdirectory.  Then use the php
56 command-line executable to run the tests.
57
58 Defaults:
59 <pre>
60 tests=all
61 db=file,dba,SQL,ADODB
62 debug=9
63 level=1
64 </pre>
65
66 For example:
67 <pre>
68 phpwiki/tests/unit % ./test.php
69 Run tests ..
70 ran 8 tests, 0 failures.
71 </pre>
72
73 Or for only some tests, give the test names on the commandline:
74
75 <pre>
76 phpwiki/tests/unit % php -Cq test.php db=dba debug=1 test=SetupWiki test=DumpHtml
77 test=SetupWiki,DumpHtml
78 db=dba
79 debug=1
80 level=1
81 pid=2544
82
83 Testing DB Backend "dba" ...
84 Purge the testbox ...
85 ran 6 tests, 0 failures.
86 </pre>
87
88 Or run it from the browser like this:
89
90 <pre>
91 http://localhost/phpwiki/test/unit/test.php?db=dba&level=10
92 http://localhost/phpwiki/test/unit/test.php?test=SetupWiki,DumpHtml&level=1
93   or
94 http://localhost/phpwiki/test/unit/test.php?test[]=SetupWiki&test[]=DumpHtml&level=1
95 </pre>
96
97 <h3>Memory Usage</h3>
98 <pre>
99 (8MB limit on certain servers)
100
101 setupwiki
102 cli:  Mem16712 => Mem16928
103 web:  Mem21216 => Mem26332 (5MB)
104
105 dumphtml
106 cli: Mem20696 => Mem31240  (with USECACHE)
107 cli: Mem20240 => Mem30212  (without USECACHE) (10MB)
108 web: Mem29424 => Mem35400  (without USECACHE) (6MB)
109 </pre>
110
111 </body>
112 </html>