MediaWiki  REL1_19
MediaWikiParserTest.php
Go to the documentation of this file.
00001 <?php
00002 require_once( dirname( __FILE__ ) . '/NewParserTest.php' );
00003 
00012 class MediaWikiParserTest {
00013 
00014         public static function suite() {
00015                 global $wgParserTestFiles;
00016 
00017                 $suite = new PHPUnit_Framework_TestSuite;
00018 
00019                 foreach ( $wgParserTestFiles as $filename ) {
00020                         $testsName = basename( $filename, '.txt' );
00021                         /* This used to be ucfirst( basename( dirname( $filename ) ) )
00022                          * and then was ucfirst( basename( $filename, '.txt' )
00023                          * but that didn't work with names like foo.tests.txt
00024                          */
00025                         $className = str_replace( '.', '_',  ucfirst( basename( $filename, '.txt' ) ) );
00026                         
00027                         eval( "/** @group Database\n@group Parser\n*/ class $className extends NewParserTest { protected \$file = '" . strtr( $filename, array( "'" => "\\'", '\\' => '\\\\' ) ) . "'; } " );
00028 
00029                         $parserTester = new $className( $testsName );
00030                         $suite->addTestSuite( new ReflectionClass ( $parserTester ) );
00031                 }
00032                 
00033 
00034                 return $suite;
00035         }
00036 }