PageRenderTime 51ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/phpunit/includes/parser/MediaWikiParserTest.php

https://github.com/spenser-roark/OOUG-Wiki
PHP | 36 lines | 19 code | 5 blank | 12 comment | 0 complexity | e685618f6ced666aa3bc84743e94216a MD5 | raw file
Possible License(s): GPL-2.0, Apache-2.0, LGPL-3.0
  1. <?php
  2. require_once( dirname( __FILE__ ) . '/NewParserTest.php' );
  3. /**
  4. * The UnitTest must be either a class that inherits from MediaWikiTestCase
  5. * or a class that provides a public static suite() method which returns
  6. * an PHPUnit_Framework_Test object
  7. *
  8. * @group Parser
  9. * @group Database
  10. */
  11. class MediaWikiParserTest {
  12. public static function suite() {
  13. global $wgParserTestFiles;
  14. $suite = new PHPUnit_Framework_TestSuite;
  15. foreach ( $wgParserTestFiles as $filename ) {
  16. $testsName = basename( $filename, '.txt' );
  17. /* This used to be ucfirst( basename( dirname( $filename ) ) )
  18. * and then was ucfirst( basename( $filename, '.txt' )
  19. * but that didn't work with names like foo.tests.txt
  20. */
  21. $className = str_replace( '.', '_', ucfirst( basename( $filename, '.txt' ) ) );
  22. eval( "/** @group Database\n@group Parser\n*/ class $className extends NewParserTest { protected \$file = '" . strtr( $filename, array( "'" => "\\'", '\\' => '\\\\' ) ) . "'; } " );
  23. $parserTester = new $className( $testsName );
  24. $suite->addTestSuite( new ReflectionClass ( $parserTester ) );
  25. }
  26. return $suite;
  27. }
  28. }