* Removed require/require_once from maintenance scripts where possible, replaced...
[lhc/web/wiklou.git] / maintenance / tests / MediaWikiParserTest.php
1 <?php
2
3 class MediaWikiParserTestSuite extends PHPUnit_Framework_TestSuite {
4 private $count;
5 public $backend;
6
7 public static function suite() {
8 return new self;
9 }
10
11 public function __construct() {
12 $this->backend = new ParserTestSuiteBackend;
13 parent::__construct();
14 }
15
16 public function run( PHPUnit_Framework_TestResult $result = null, $filter = false,
17 array $groups = array(), array $excludeGroups = array(), $processIsolation = false
18 ) {
19 global $IP;
20 $this->backend->setupDatabase();
21
22 $iter = new TestFileIterator( "$IP/maintenance/parserTests.txt" );
23 $iter->setParser( $this->backend );
24 $this->count = 0;
25
26 foreach ( $iter as $test ) {
27 $this->addTest( new ParserUnitTest( $this, $test ) );
28 $this->count++;
29 }
30
31 parent::run( $result, $filter, $groups, $excludeGroups, $processIsolation );
32
33 $this->backend->teardownDatabase();
34 }
35
36 public function count() {
37 return $this->count;
38 }
39
40 public function toString() {
41 return "MediaWiki Parser Tests";
42 }
43
44 public function getBackend() {
45 return $this->backend;
46 }
47
48 public function getIterator() {
49 return $this->iterator;
50 }
51 }
52