diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2013-09-04 05:51:59 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2013-09-04 05:51:59 +0200 |
commit | 91e194556c52d2f354344f930419eef2dd6267f0 (patch) | |
tree | 0cd12490d3cd3499274017c9b799d0f738d3719e /tests/phpunit/includes/parser/MediaWikiParserTest.php | |
parent | 08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 (diff) |
Update to MediaWiki 1.21.2
Diffstat (limited to 'tests/phpunit/includes/parser/MediaWikiParserTest.php')
-rw-r--r-- | tests/phpunit/includes/parser/MediaWikiParserTest.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/phpunit/includes/parser/MediaWikiParserTest.php b/tests/phpunit/includes/parser/MediaWikiParserTest.php new file mode 100644 index 00000000..067a7c4e --- /dev/null +++ b/tests/phpunit/includes/parser/MediaWikiParserTest.php @@ -0,0 +1,34 @@ +<?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' ); + /* 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 + */ + $className = str_replace( '.', '_', ucfirst( $testsName ) ); + + eval( "/** @group Database\n@group Parser\n*/ class $className extends NewParserTest { protected \$file = '" . strtr( $filename, array( "'" => "\\'", '\\' => '\\\\' ) ) . "'; } " ); + + $parserTester = new $className( $testsName ); + $suite->addTestSuite( new ReflectionClass ( $parserTester ) ); + } + return $suite; + } +} |