dokuwiki/_test
Andreas Gohr 2cf7c325f8 Replace Appveyor and Travis with Github actions
Travis has recently introduced built limits which makes using them very
slow sometimes and I never really liked the setup for appveyor for our
Windows testing.

This makes use of github actions instead. Some notes:

* since we only support PHP 7.2+ anymore, nothing below is tested
* MySQL and Postgres auth backends are only tested on Linux (as before)
* I am not actually sure the problem matchers are working as intended
* There is currently no good way to run tests that are allowed to fail
  so no PHP 8 tests are run yet
* I haven't reestablished the no-gzip test runs again, I'm not sure they
  are still relevant on modern PHP systems
* PHP 7.4 currently fails because of https://github.com/MarcusSchwarz/lesserphp/pull/18
* I'm currently using @v2 tags for the used action. We had a discussion
  before if we should actually pin the action to a fixed commit. For
  sake of easier maintainance, I would argue to trust the setup-php
  action.
2020-11-20 23:50:01 +01:00
..
conf disable update check by default during tests 2020-04-09 11:21:05 +02:00
core Fix curly brace deprecations in _test/ directory. 2019-10-31 13:24:50 +01:00
data move test page somewhere else to not interfere with other tests 2017-09-02 14:49:06 +02:00
mock separate some test AuthPlugins to single files 2020-03-08 18:09:26 -04:00
tests Merge pull request #2433 from splitbrain/issue2399 2020-10-13 13:10:58 +02:00
README Fixed broken links to php.net and redirecting pages to php.net 2016-06-14 08:48:12 +02:00
bootstrap.php run all tests without mbstring support 2020-06-02 21:44:41 +02:00
fetchphpunit.php Replace Appveyor and Travis with Github actions 2020-11-20 23:50:01 +01:00
mysql.conf.php.dist Replace Appveyor and Travis with Github actions 2020-11-20 23:50:01 +01:00
pgsql.conf.php.dist Replace Appveyor and Travis with Github actions 2020-11-20 23:50:01 +01:00
phpcs.xml Split out temporary code style excludes 2020-02-19 10:55:56 +01:00
phpcs_MigrationAdjustments.xml Split out temporary code style excludes 2020-02-19 10:55:56 +01:00
phpunit.xml Also allow test files ending in Test.php 2018-05-20 11:56:24 +02:00

README

====== DokuWiki Test Suite ======

This is the test suite to automatically test various parts of DokuWiki.

===== Requirements =====

  * PHPUnit 3.6.10+ http://www.phpunit.de/
  * PHP 5.3+ http://php.net

===== PHPUnit Installation ======

You can install phpunit through your distribution's package manager or simply
download the newest phar file into the _test directory:

  cd _test/
  wget https://phar.phpunit.de/phpunit.phar


===== Running all tests =====

Just change to the ''_test'' directory and run phpunit (depending on your install
method):

  cd _test/
  phpunit

or

  cd _test/
  php phpunit.phar

===== Troubleshooting =====

PHPUnit will fail on some systems with a //headers already sent// error.
This is a known problem with PHPUnit, the error can be avoided by passing the
'--stderr' flag to phpunit:

  phpunit --stderr

On windows you may have to enable OpenSSL support for https tests.
Some of them point to httpclient_http.tests.php on the failure.
To enable HTTPS support copy the ''libeay32.dll'' and ''ssleay32.dll''
to your ''windows\system32'' folder and add the following line to your php.ini
in the extension section:

<code ini>
extension=php_openssl.dll
</code>

===== Running selected Tests =====

You can run a single test file by providing it as an argument to phpunit:

  phpunit tests/inc/common_cleanText.test.php

You can also use groups to exclude certain test from running. For example use
the following command to avoid long running test or tests accessing the
Internet.

  phpunit --exclude-group slow,internet

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

===== TODO for the test framework =====

  * optional: add helper methods to TestRequest for easy form submission
    * createForm(), ...
  * check PHP Unit test_helpers https://github.com/sebastianbergmann/php-test-helpers