wiki.techinc.nl/tests/phpunit/includes/parser/MediaWikiParserTest.php
Timo Tijhof beb1c4a0ec phpcs: More require/include is not a function
Follows-up I1343872de7, Ia533aedf63 and I2df2f80b81.

Also updated usage in text in documentation and the
installer LocalSettingsGenerator.

Most of them were handled by this regex:
- find: (require|include|require_once|include_once)\s*\(\s*(.+?)\s*\)\s*;$
- replace: $1 $2;

Change-Id: I6b38aad9a5149c9c43ce18bd8edbab14b8ce43fa
2013-05-21 23:26:28 +02:00

47 lines
1.3 KiB
PHP

<?php
require_once __DIR__ . '/NewParserTest.php';
/**
* The UnitTest must be either a class that inherits from MediaWikiTestCase
* 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 $wgParserTestFiles;
$suite = new PHPUnit_Framework_TestSuite;
foreach ( $wgParserTestFiles as $fileName ) {
$testsName = basename( $fileName, '.txt' );
$escapedFileName = strtr( $fileName, array( "'" => "\\'", '\\' => '\\\\' ) );
/* This used to be ucfirst( basename( dirname( $filename ) ) )
* and then was ucfirst( basename( $filename, '.txt' )
* but that didn't work with names like foo.tests.txt
*/
$parserTestClassName = str_replace( '.', '_', ucfirst( $testsName ) );
$parserTestClassDefinition = <<<EOT
/**
* @group Database
* @group Parser
* @group ParserTests
* @group ParserTests_$parserTestClassName
*/
class $parserTestClassName extends NewParserTest {
protected \$file = '$escapedFileName';
}
EOT;
eval( $parserTestClassDefinition );
$parserTester = new $parserTestClassName( $testsName );
$suite->addTestSuite( new ReflectionClass ( $parserTester ) );
}
return $suite;
}
}