3 require_once( dirname( __FILE__
) . '/ParserHelpers.php' );
4 require_once( dirname(dirname(dirname( __FILE__
))) . '/bootstrap.php' );
6 class MediaWikiParserTest
extends MediaWikiTestSetup
{
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 $suite = new PHPUnit_Framework_TestSuite('Parser Tests');
13 parent
::__construct($suite);
14 $this->backend
= new ParserTestSuiteBackend
;
15 $this->setName( 'Parser tests' );
18 public static function suite() {
23 $iter = new TestFileIterator( "$IP/maintenance/tests/parser/parserTests.txt", $tester );
26 foreach ( $iter as $test ) {
27 $tester->suite
->addTest( new ParserUnitTest( $tester, $test ), array( 'Parser', 'Destructive', 'Database', 'Broken' ) );
31 return $tester->suite
;
34 public function count() {
38 public function toString() {
39 return "MediaWiki Parser Tests";
42 public function getBackend() {
43 return $this->backend
;
46 public function getIterator() {
47 return $this->iterator
;
50 public function publishTestArticles() {
51 if ( empty( $this->articles
) ) {
55 foreach ( $this->articles
as $name => $text ) {
56 $title = Title
::newFromText( $name );
58 if ( $title->getArticleID( Title
::GAID_FOR_UPDATE
) == 0 ) {
59 ParserTest
::addArticle( $name, $text );
62 $this->articles
= array();
65 public function addArticle( $name, $text, $line ) {
66 $this->articles
[$name] = $text;
69 public function showRunFile( $path ) {
70 /* Nothing shown when run from phpunit */