2004-09-22 12:25:40 +00:00
|
|
|
<?php
|
2004-09-23 00:33:07 +00:00
|
|
|
# Copyright (C) 2004 Brion Vibber <brion@pobox.com>
|
|
|
|
|
# http://www.mediawiki.org/
|
2005-07-06 16:17:02 +00:00
|
|
|
#
|
2004-09-23 00:33:07 +00:00
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
2005-07-06 16:17:02 +00:00
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
2004-09-23 00:33:07 +00:00
|
|
|
# (at your option) any later version.
|
2005-07-06 16:17:02 +00:00
|
|
|
#
|
2004-09-23 00:33:07 +00:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
# GNU General Public License for more details.
|
2005-07-06 16:17:02 +00:00
|
|
|
#
|
2004-09-23 00:33:07 +00:00
|
|
|
# You should have received a copy of the GNU General Public License along
|
|
|
|
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
2006-04-05 07:43:17 +00:00
|
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2004-09-23 00:33:07 +00:00
|
|
|
# http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
|
2004-09-22 12:25:40 +00:00
|
|
|
/**
|
2007-01-20 15:09:52 +00:00
|
|
|
* @addtogroup Maintenance
|
2004-09-22 12:25:40 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/** */
|
2005-07-06 16:17:02 +00:00
|
|
|
require('parserTests.inc');
|
2004-09-22 12:25:40 +00:00
|
|
|
|
2004-10-27 09:21:25 +00:00
|
|
|
if( isset( $options['help'] ) ) {
|
2006-10-18 09:22:33 +00:00
|
|
|
echo <<<ENDS
|
2004-10-27 09:21:25 +00:00
|
|
|
MediaWiki $wgVersion parser test suite
|
2006-10-18 09:22:33 +00:00
|
|
|
Usage: php parserTests.php [--quick] [--quiet] [--show-output]
|
2007-01-17 21:24:41 +00:00
|
|
|
[--color[=(yes|no)]]
|
2006-06-01 04:00:41 +00:00
|
|
|
[--regex=<expression>] [--file=<testfile>]
|
2007-01-09 14:20:50 +00:00
|
|
|
[--record]
|
2006-06-01 04:00:41 +00:00
|
|
|
[--help]
|
2004-10-27 09:21:25 +00:00
|
|
|
Options:
|
2006-10-18 09:22:33 +00:00
|
|
|
--quick Suppress diff output of failed tests
|
|
|
|
|
--quiet Suppress notification of passed tests (shows only failed tests)
|
|
|
|
|
--show-output Show expected and actual output
|
|
|
|
|
--color Override terminal detection and force color output on or off
|
2007-01-17 21:24:41 +00:00
|
|
|
use wgCommandLineDarkBg = true; if your term is dark
|
2006-10-18 09:22:33 +00:00
|
|
|
--regex Only run tests whose descriptions which match given regex
|
|
|
|
|
--file Run test cases from a custom file instead of parserTests.txt
|
2007-01-09 14:20:50 +00:00
|
|
|
--record Record tests in database
|
2006-10-18 09:22:33 +00:00
|
|
|
--help Show this help message
|
2004-10-27 09:21:25 +00:00
|
|
|
|
|
|
|
|
|
2006-10-18 09:22:33 +00:00
|
|
|
ENDS;
|
2005-07-06 16:17:02 +00:00
|
|
|
exit( 0 );
|
2004-10-27 09:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2004-10-15 17:46:42 +00:00
|
|
|
# There is a convention that the parser should never
|
|
|
|
|
# refer to $wgTitle directly, but instead use the title
|
|
|
|
|
# passed to it.
|
|
|
|
|
$wgTitle = Title::newFromText( 'Parser test script do not use' );
|
2006-07-11 14:11:23 +00:00
|
|
|
$tester = new ParserTest();
|
2004-09-23 00:33:07 +00:00
|
|
|
|
2006-06-01 04:00:41 +00:00
|
|
|
if( isset( $options['file'] ) ) {
|
2006-11-11 14:36:47 +00:00
|
|
|
$files = array( $options['file'] );
|
2006-06-01 04:00:41 +00:00
|
|
|
} else {
|
2006-11-11 14:36:47 +00:00
|
|
|
// Default parser tests and any set from extensions or local config
|
|
|
|
|
$files = $wgParserTestFiles;
|
2006-06-01 04:00:41 +00:00
|
|
|
}
|
2006-12-26 21:26:18 +00:00
|
|
|
|
|
|
|
|
# Print out software version to assist with locating regressions
|
|
|
|
|
$version = SpecialVersion::getVersion();
|
2007-01-19 09:00:45 +00:00
|
|
|
echo( "This is MediaWiki version {$version}.\n\n" );
|
2006-11-11 14:36:47 +00:00
|
|
|
$ok = $tester->runTestsFromFiles( $files );
|
2004-09-23 00:33:07 +00:00
|
|
|
|
|
|
|
|
exit ($ok ? 0 : -1);
|
2005-04-20 03:28:10 +00:00
|
|
|
?>
|