142dcf8b1SAndreas Gohr====== DokuWiki Test Suite ====== 2f8369d7dSTobias Sarnowski 342dcf8b1SAndreas GohrThis is the test suit to automatically test various parts of DokuWiki. 4f8369d7dSTobias Sarnowski 542dcf8b1SAndreas Gohr===== Requirements ===== 642dcf8b1SAndreas Gohr 742dcf8b1SAndreas Gohr * PHPUnit 3.6.10+ http://www.phpunit.de/ 842dcf8b1SAndreas Gohr * PHP 5.3+ http://www.php.net 942dcf8b1SAndreas Gohr 1042dcf8b1SAndreas Gohr===== PHPUnit Installation ====== 1142dcf8b1SAndreas Gohr 1242dcf8b1SAndreas Gohrvia PEAR: 1342dcf8b1SAndreas Gohr 1442dcf8b1SAndreas Gohr pear config-set auto_discover 1 1542dcf8b1SAndreas Gohr pear upgrade 1642dcf8b1SAndreas Gohr pear install pear.phpunit.de/PHPUnit 1742dcf8b1SAndreas Gohr 1842dcf8b1SAndreas Gohron Windows: 1942dcf8b1SAndreas Gohr 2042dcf8b1SAndreas Gohr FIXME 21f8369d7dSTobias Sarnowski 22f8369d7dSTobias Sarnowski 2342dcf8b1SAndreas Gohr===== Running all Tests ===== 24f8369d7dSTobias Sarnowski 2542dcf8b1SAndreas GohrJust change to the ''_test'' directory and run phpunit: 26f8369d7dSTobias Sarnowski 2742dcf8b1SAndreas Gohr cd _testing/ 2842dcf8b1SAndreas Gohr phpunit 29f8369d7dSTobias Sarnowski 3042dcf8b1SAndreas GohrPHPUnit will fail on some systems with a //headers already sent// error. 3142dcf8b1SAndreas GohrThis is a known problem with PHPUnit, the error can be avoided by passing the 3242dcf8b1SAndreas Gohr'--stderr' flag to phpunit: 33f8369d7dSTobias Sarnowski 3442dcf8b1SAndreas Gohr phpunit --stderr 35f8369d7dSTobias Sarnowski 3642dcf8b1SAndreas Gohr===== Running selected Tests ===== 37f8369d7dSTobias Sarnowski 3842dcf8b1SAndreas GohrYou can run a single test file by providing it as an argument to phpunit: 39f8369d7dSTobias Sarnowski 4042dcf8b1SAndreas Gohr phpunit --stderr tests/inc/common_cleanText.test.php 41f8369d7dSTobias Sarnowski 42*f7161c34SAndreas GohrYou can also use groups to exclude certain test from running. For example use 43*f7161c34SAndreas Gohrthe following command to avoid long running test or tests accessing the 44*f7161c34SAndreas GohrInternet. 45*f7161c34SAndreas Gohr 46*f7161c34SAndreas Gohr phpunit --stderr --exclude-group slow,internet 47f8369d7dSTobias Sarnowski 4842dcf8b1SAndreas Gohr===== Create new Tests ===== 49f8369d7dSTobias Sarnowski 50f8369d7dSTobias SarnowskiTo create a test for DokuWiki, create a *.test.php file within the tests/ 51f8369d7dSTobias Sarnowskifolder. Please respect the folder structure and naming convention. Inside the 52f8369d7dSTobias Sarnowskifile, implement a class, extending 'DokuWikiTest'. Every method, starting 53f8369d7dSTobias Sarnowskiwith 'test' will be called as a test (e.g. 'testIfThisIsValid'); 54f8369d7dSTobias Sarnowski 55f8369d7dSTobias Sarnowski 5642dcf8b1SAndreas Gohr===== TODO for the test framework ===== 57f8369d7dSTobias Sarnowski 58f8369d7dSTobias Sarnowski * test cross platform compatibility: especially test windows 59f8369d7dSTobias Sarnowski * update http://www.dokuwiki.org/devel:unittesting 60f8369d7dSTobias Sarnowski * optional: add helper methods to TestRequest for easy form submission 61f8369d7dSTobias Sarnowski * createForm(), ... 6242dcf8b1SAndreas Gohr * check PHP Unit test_helpers https://github.com/sebastianbergmann/php-test-helpers 63f8369d7dSTobias Sarnowski 64f8369d7dSTobias Sarnowski 6542dcf8b1SAndreas Gohr===== Migration Protocol ===== 66f8369d7dSTobias Sarnowski 67f8369d7dSTobias SarnowskiThe following tests were not migrated: 68f8369d7dSTobias Sarnowski 69f8369d7dSTobias Sarnowski * inc/indexer_idx_indexlengths (fs dependencies) 70f8369d7dSTobias Sarnowski * inc/mail_send (integration test) 71f8369d7dSTobias Sarnowski * inc/parser/parser_formatting 72f8369d7dSTobias Sarnowski * inc/parser/xhtml_htmlphp (runkit) 73f8369d7dSTobias Sarnowski * inc/parser/xhtml_links 74f8369d7dSTobias Sarnowski 75