summaryrefslogtreecommitdiff
path: root/www/wiki/tests/phpunit/suites/ParserTestFileSuite.php
blob: b72d8b84e3be101889ac85866cae0235ea9264a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php

/**
 * This is the suite class for running tests within a single .txt source file.
 * It is not invoked directly. Use --filter to select files, or
 * use parserTests.php.
 */
class ParserTestFileSuite extends PHPUnit_Framework_TestSuite {
	private $ptRunner;
	private $ptFileName;
	private $ptFileInfo;

	function __construct( $runner, $name, $fileName ) {
		parent::__construct( $name );
		$this->ptRunner = $runner;
		$this->ptFileName = $fileName;
		$this->ptFileInfo = TestFileReader::read( $this->ptFileName );

		foreach ( $this->ptFileInfo['tests'] as $test ) {
			$this->addTest( new ParserIntegrationTest( $runner, $fileName, $test ),
				[ 'Database', 'Parser', 'ParserTests' ] );
		}
	}

	function setUp() {
		if ( !$this->ptRunner->meetsRequirements( $this->ptFileInfo['requirements'] ) ) {
			$this->markTestSuiteSkipped( 'required extension not enabled' );
		} else {
			$this->ptRunner->addArticles( $this->ptFileInfo[ 'articles'] );
		}
	}
}