0410a96918464c773d1b33082d8bd6b53afb7658
[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 $this->setName( 'Parser tests' );
15 }
16
17 public function run( PHPUnit_Framework_TestResult $result = null, $filter = false,
18 array $groups = array(), array $excludeGroups = array(), $processIsolation = false
19 ) {
20 global $IP;
21 $this->backend->setupDatabase();
22
23 $iter = new TestFileIterator( "$IP/maintenance/parserTests.txt" );
24 $iter->setParser( $this->backend );
25 $this->count = 0;
26
27 foreach ( $iter as $test ) {
28 $this->addTest( new ParserUnitTest( $this, $test ) );
29 $this->count++;
30 }
31
32 parent::run( $result, $filter, $groups, $excludeGroups, $processIsolation );
33
34 $this->backend->teardownDatabase();
35 }
36
37 public function count() {
38 return $this->count;
39 }
40
41 public function toString() {
42 return "MediaWiki Parser Tests";
43 }
44
45 public function getBackend() {
46 return $this->backend;
47 }
48
49 public function getIterator() {
50 return $this->iterator;
51 }
52 }
53