3 require_once( dirname( __FILE__
) . '/ParserHelpers.php' );
4 require_once( dirname(dirname(dirname( __FILE__
))) . '/bootstrap.php' );
6 class MediaWikiParserTest
extends MediaWikiTestCase
{
7 public $count; // Number of tests in the suite.
8 public $backend; // ParserTestSuiteBackend instance
9 public $articles = array(); // Array of test articles defined by the tests
11 public function __construct() {
12 parent
::__construct();
13 $this->backend
= new ParserTestSuiteBackend
;
14 $this->setName( 'Parser tests' );
17 public static function suite() {
21 $tester->suite
= new PHPUnit_Framework_TestSuite('Parser Tests');
23 //Fixme: Use all the wgParserTestFiles (or whatever that global was...)
24 $iter = new TestFileIterator( "$IP/tests/parser/parserTests.txt", $tester );
27 foreach ( $iter as $test ) {
28 $tester->suite
->addTest( new ParserUnitTest( $tester, $test ), array( 'Parser', 'Destructive', 'Database', 'Broken' ) );
32 return $tester->suite
;
35 public function count() {
39 public function toString() {
40 return "MediaWiki Parser Tests";
43 public function getBackend() {
44 return $this->backend
;
47 public function getIterator() {
48 return $this->iterator
;
51 public function publishTestArticles() {
52 if ( empty( $this->articles
) ) {
56 foreach ( $this->articles
as $name => $text ) {
57 $title = Title
::newFromText( $name );
59 if ( $title->getArticleID( Title
::GAID_FOR_UPDATE
) == 0 ) {
60 ParserTest
::addArticle( $name, $text );
63 $this->articles
= array();
66 public function addArticle( $name, $text, $line ) {
67 $this->articles
[$name] = $text;
70 public function showRunFile( $path ) {
71 /* Nothing shown when run from phpunit */