xref: /dokuwiki/_test/README (revision a060f5a0bcf2bd42191c466160b31778110b4a6f)
19420a794SAndreas Gohr====== DokuWiki Test Suite and Develpoment Tools ======
2f8369d7dSTobias Sarnowski
39420a794SAndreas GohrThis directory contains the test suite for DokuWiki as well as configuration for various code quality tools.
4f8369d7dSTobias Sarnowski
59420a794SAndreas Gohr===== Setup =====
642dcf8b1SAndreas Gohr
79420a794SAndreas GohrBefore you can use any of the tools you need to install the dependencies. This is done using composer.
842dcf8b1SAndreas Gohr
99420a794SAndreas Gohr  composer install
1042dcf8b1SAndreas Gohr
119420a794SAndreas GohrIf you don't have composer installed yet, you can get it from https://getcomposer.org/
1242dcf8b1SAndreas Gohr
139420a794SAndreas Gohr===== Composer Scripts =====
14f8369d7dSTobias Sarnowski
159420a794SAndreas GohrThe composer configuration contains a number of scripts to run the various tools on all of DokuWiki.
16f8369d7dSTobias Sarnowski
179420a794SAndreas GohrRun all the tests:
18f8369d7dSTobias Sarnowski
199420a794SAndreas Gohr  composer run test
20f8369d7dSTobias Sarnowski
219420a794SAndreas GohrCheck for code style violations:
22f8369d7dSTobias Sarnowski
239420a794SAndreas Gohr  composer run check
247a7b77efSAndreas Gohr
259420a794SAndreas GohrAutomatically fix code style violations:
267a7b77efSAndreas Gohr
279420a794SAndreas Gohr  composer run autofix
287a7b77efSAndreas Gohr
299420a794SAndreas Gohr===== Tools =====
30f8369d7dSTobias Sarnowski
319420a794SAndreas GohrAll the tools can be called directly from the ''vendor/bin'' directory.
32f8369d7dSTobias Sarnowski
339420a794SAndreas Gohr==== PHPUnit ====
347a7b77efSAndreas Gohr
359420a794SAndreas Gohr  ./vendor/bin/phpunit --verbose --stderr
36f77b4d4fSDominik Eckelmann
379420a794SAndreas GohrThe --stderr flag is needed to avoid a headers already sent error on some systems.
38f8369d7dSTobias Sarnowski
399420a794SAndreas GohrTo learn more about running tests and writing your own, visit https://www.dokuwiki.org/devel:unittesting
40f8369d7dSTobias Sarnowski
419420a794SAndreas Gohr==== PHP CodeSniffer ====
42f8369d7dSTobias Sarnowski
439420a794SAndreas GohrTo check for code violations:
44f7161c34SAndreas Gohr
459420a794SAndreas Gohr  ./vendor/bin/phpcs
46f8369d7dSTobias Sarnowski
479420a794SAndreas GohrTo automatically fix code violations:
48f8369d7dSTobias Sarnowski
499420a794SAndreas Gohr  ./vendor/bin/phpcbf
50f8369d7dSTobias Sarnowski
519420a794SAndreas GohrTo learn more about PHP CodeSniffer visit https://www.dokuwiki.org/devel:phpcodesniffer
52f8369d7dSTobias Sarnowski
539420a794SAndreas Gohr==== Rector ====
54f8369d7dSTobias Sarnowski
559420a794SAndreas GohrTo automatically fix code smells
569420a794SAndreas Gohr
579420a794SAndreas Gohr  ./vendor/bin/rector process
589420a794SAndreas Gohr
599420a794SAndreas GohrTo learn more about PHP CodeSniffer visit https://www.dokuwiki.org/devel:rector
60f8369d7dSTobias Sarnowski
6125a70af9SWillForan
6225a70af9SWillForan===== 32-bit =====
6325a70af9SWillForan
6425a70af9SWillForanPHP 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
6525a70af9SWillForan
66*a060f5a0SWillForanIn the meantime, 32-bit containers (''--platform linux/386'') can provide testing for 64bit hosts. NB. The more approprate ''php:8.3.26RC1-zts-alpine3.21'' does not have `bcmath` need by `bitmask64On32` (../inc/Ip32.php); `wpstaging/php:8.3-32bit` is one container that does include the library.
6725a70af9SWillForan
6825a70af9SWillForanAfter local ''composer install''
6925a70af9SWillForan
7025a70af9SWillForan  podman run -v $PWD/..:/dokuwiki \
7125a70af9SWillForan    \--platform linux/386 --workdir /dokuwiki/_test  \
72*a060f5a0SWillForan    docker://wpstaging/php:8.3-32bit \
7325a70af9SWillForan    ./vendor/bin/phpunit --verbose --stderr \
7425a70af9SWillForan    # --filter ip_test
7525a70af9SWillForan
7625a70af9SWillForan<!-- emacs file-local settings
7725a70af9SWillForanLocal Variables:
7825a70af9SWillForanmode: dokuwiki
7925a70af9SWillForanEnd:
8025a70af9SWillForan-->
81