xref: /dokuwiki/_test/README (revision 9420a794ec98c09d6cf1a7944fd21476ea1b3c3b)
1*9420a794SAndreas Gohr====== DokuWiki Test Suite and Develpoment Tools ======
2f8369d7dSTobias Sarnowski
3*9420a794SAndreas GohrThis directory contains the test suite for DokuWiki as well as configuration for various code quality tools.
4f8369d7dSTobias Sarnowski
5*9420a794SAndreas Gohr===== Setup =====
642dcf8b1SAndreas Gohr
7*9420a794SAndreas GohrBefore you can use any of the tools you need to install the dependencies. This is done using composer.
842dcf8b1SAndreas Gohr
9*9420a794SAndreas Gohr  composer install
1042dcf8b1SAndreas Gohr
11*9420a794SAndreas GohrIf you don't have composer installed yet, you can get it from https://getcomposer.org/
1242dcf8b1SAndreas Gohr
13*9420a794SAndreas Gohr===== Composer Scripts =====
14f8369d7dSTobias Sarnowski
15*9420a794SAndreas GohrThe composer configuration contains a number of scripts to run the various tools on all of DokuWiki.
16f8369d7dSTobias Sarnowski
17*9420a794SAndreas GohrRun all the tests:
18f8369d7dSTobias Sarnowski
19*9420a794SAndreas Gohr  composer run test
20f8369d7dSTobias Sarnowski
21*9420a794SAndreas GohrCheck for code style violations:
22f8369d7dSTobias Sarnowski
23*9420a794SAndreas Gohr  composer run check
247a7b77efSAndreas Gohr
25*9420a794SAndreas GohrAutomatically fix code style violations:
267a7b77efSAndreas Gohr
27*9420a794SAndreas Gohr  composer run autofix
287a7b77efSAndreas Gohr
29*9420a794SAndreas Gohr===== Tools =====
30f8369d7dSTobias Sarnowski
31*9420a794SAndreas GohrAll the tools can be called directly from the ''vendor/bin'' directory.
32f8369d7dSTobias Sarnowski
33*9420a794SAndreas Gohr==== PHPUnit ====
347a7b77efSAndreas Gohr
35*9420a794SAndreas Gohr  ./vendor/bin/phpunit --verbose --stderr
36f77b4d4fSDominik Eckelmann
37*9420a794SAndreas GohrThe --stderr flag is needed to avoid a headers already sent error on some systems.
38f8369d7dSTobias Sarnowski
39*9420a794SAndreas GohrTo learn more about running tests and writing your own, visit https://www.dokuwiki.org/devel:unittesting
40f8369d7dSTobias Sarnowski
41*9420a794SAndreas Gohr==== PHP CodeSniffer ====
42f8369d7dSTobias Sarnowski
43*9420a794SAndreas GohrTo check for code violations:
44f7161c34SAndreas Gohr
45*9420a794SAndreas Gohr  ./vendor/bin/phpcs
46f8369d7dSTobias Sarnowski
47*9420a794SAndreas GohrTo automatically fix code violations:
48f8369d7dSTobias Sarnowski
49*9420a794SAndreas Gohr  ./vendor/bin/phpcbf
50f8369d7dSTobias Sarnowski
51*9420a794SAndreas GohrTo learn more about PHP CodeSniffer visit https://www.dokuwiki.org/devel:phpcodesniffer
52f8369d7dSTobias Sarnowski
53*9420a794SAndreas Gohr==== Rector ====
54f8369d7dSTobias Sarnowski
55*9420a794SAndreas GohrTo automatically fix code smells
56*9420a794SAndreas Gohr
57*9420a794SAndreas Gohr  ./vendor/bin/rector process
58*9420a794SAndreas Gohr
59*9420a794SAndreas GohrTo learn more about PHP CodeSniffer visit https://www.dokuwiki.org/devel:rector
60f8369d7dSTobias Sarnowski
61