Manual talk:PHP unit testing/Running the tests

From mediawiki.org
Jump to navigation Jump to search

Outdated instructions[edit]

The terminal instructions suggests "make databaseless" to prepare tests. Here the results. --Dereckson (talk) 02:55, 10 January 2013 (UTC)

/home/dereckson/dev/mediawiki/bench/core/tests/phpunit ] make databaseless
php phpunit.php --configuration /suite.xml  --exclude-group Broken,ParserFuzz,Destructive,Database,Stub
Could not read "/suite.xml".
*** Error code 1
Stop in /usr/home/dereckson/dev/mediawiki/bench/core/tests/phpunit.
Actually, this is a UNIX-compliance issue in Makefile: $(shell command) is a GNU-only Make extension.
$PWD would work everywhere.
Reported at Bugzilla:43808 --Dereckson (talk) 03:03, 10 January 2013 (UTC)

How to run tests without a foo.suite.xml?[edit]

Most extensions don't have a foo.suite.xml file, yet somehow their tests run. Developers need to know how to run existing PHP tests without faffing about with .xml files. There are no instructions for this, and pointing phpunit.php at a particular test fails for me

% cd tests/phpunit
% php phpunit.php ../../extensions/AbuseFilter/tests/legacyParserTest.php
PHP Notice:  Constant MEDIAWIKI already defined in /home/spage/projects/core/maintenance/Maintenance.php on line 526
...
Notice: Undefined variable: IP in /home/spage/projects/core/maintenance/doMaintenance.php on line 57
...
Warning: require_once(/includes/AutoLoader.php): failed to open stream: No such file or directory in /home/spage/projects/core/maintenance/doMaintenance.php on line 57