xref: /dokuwiki/_test/README (revision 25a70af9b4a17fa21228193868c69038088160af)
1====== DokuWiki Test Suite and Develpoment Tools ======
2
3This directory contains the test suite for DokuWiki as well as configuration for various code quality tools.
4
5===== Setup =====
6
7Before you can use any of the tools you need to install the dependencies. This is done using composer.
8
9  composer install
10
11If you don't have composer installed yet, you can get it from https://getcomposer.org/
12
13===== Composer Scripts =====
14
15The composer configuration contains a number of scripts to run the various tools on all of DokuWiki.
16
17Run all the tests:
18
19  composer run test
20
21Check for code style violations:
22
23  composer run check
24
25Automatically fix code style violations:
26
27  composer run autofix
28
29===== Tools =====
30
31All the tools can be called directly from the ''vendor/bin'' directory.
32
33==== PHPUnit ====
34
35  ./vendor/bin/phpunit --verbose --stderr
36
37The --stderr flag is needed to avoid a headers already sent error on some systems.
38
39To learn more about running tests and writing your own, visit https://www.dokuwiki.org/devel:unittesting
40
41==== PHP CodeSniffer ====
42
43To check for code violations:
44
45  ./vendor/bin/phpcs
46
47To automatically fix code violations:
48
49  ./vendor/bin/phpcbf
50
51To learn more about PHP CodeSniffer visit https://www.dokuwiki.org/devel:phpcodesniffer
52
53==== Rector ====
54
55To automatically fix code smells
56
57  ./vendor/bin/rector process
58
59To learn more about PHP CodeSniffer visit https://www.dokuwiki.org/devel:rector
60
61
62===== 32-bit =====
63
64PHP 9 may drop 32bit support. Security updates for 8.4 end on 2028-12-31. See https://wiki.php.net/rfc/drop_32bit_support and https://www.php.net/supported-versions.php
65
66In the meantime, 32-bit containers (''--platform linux/386'') can provide testing for 64bit hosts. NB. ''php:8.3.26RC1-zts-alpine3.21'' does not have bcmath.
67
68After local ''composer install''
69
70  podman run -v $PWD/..:/dokuwiki \
71    \--platform linux/386 --workdir /dokuwiki/_test  \
72    docker://php:8.3.26RC1-zts-alpine3.21 \
73    ./vendor/bin/phpunit --verbose --stderr \
74    # --filter ip_test
75
76<!-- emacs file-local settings
77Local Variables:
78mode: dokuwiki
79End:
80-->
81