Mixture of the NewParserTests.php with old code present in MediaWikiParserTest.php, reverting r79184 (revert of a revert...) and even eval(). Using the iterator as dataProvider, but defering the insertion of articles, as the dataprovider is processed on load, before switching dbs. Each parser test appear now as a phpunit test. This means that by adding 683 tests (partly from extensions) we now surpass two thousand tests. The downside of that is that they become painfully slow. Initialise $wgHooks to $wgHooks, not to array() (r82499) as otherwise we lose ParserFirstCallInit registrations. There's no attempt to support extensions registering to $wgParser instead of using ParserFirstCallInit properly (Cite falls in this category).
35 lines
1.1 KiB
PHP
35 lines
1.1 KiB
PHP
<?php
|
|
|
|
require_once( dirname( __FILE__ ) . '/ParserHelpers.php' );
|
|
require_once( dirname( __FILE__ ) . '/NewParserTest.php' );
|
|
require_once( dirname(dirname(dirname( __FILE__ ))) . '/bootstrap.php' );
|
|
|
|
/**
|
|
* The UnitTest must be either a class that inherits from PHPUnit_Framework_TestCase
|
|
* or a class that provides a public static suite() method which returns
|
|
* an PHPUnit_Framework_Test object
|
|
*
|
|
* @group Parser
|
|
* @group Database
|
|
*/
|
|
class MediaWikiParserTest {
|
|
|
|
public static function suite() {
|
|
global $IP, $wgParserTestFiles;
|
|
|
|
$suite = new PHPUnit_Framework_TestSuite;
|
|
|
|
foreach ( $wgParserTestFiles as $filename ) {
|
|
$testsName = basename( $filename, '.txt' );
|
|
$className = /*ucfirst( basename( dirname( $filename ) ) ) .*/ ucfirst( basename( $filename, '.txt' ) );
|
|
|
|
eval( "/** @group Database\n@group Parser\n*/ class $className extends NewParserTest { protected \$file = \"" . addslashes( $filename ) . "\"; } " );
|
|
|
|
$parserTester = new $className( $testsName );
|
|
$suite->addTestSuite( new ReflectionClass ( $parserTester ) );
|
|
}
|
|
|
|
|
|
return $suite;
|
|
}
|
|
}
|