wiki.techinc.nl/tests/phpunit/suites/ParserTestFileSuite.php
Max Semenik 48a323f702 tests: Add explicit return type void to setUp() and tearDown()
Bug: T192167
Depends-On: I581e54278ac5da3f4e399e33f2c7ad468bae6b43
Change-Id: I3a21fb55db76bac51afdd399cf40ed0760e4f343
2019-10-30 14:31:22 -07:00

34 lines
1,002 B
PHP

<?php
use PHPUnit\Framework\TestSuite;
/**
* 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 TestSuite {
private $ptRunner;
private $ptFileName;
private $ptFileInfo;
public 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' ] );
}
}
public function setUp() : void {
if ( !$this->ptRunner->meetsRequirements( $this->ptFileInfo['requirements'] ) ) {
$this->markTestSuiteSkipped( 'required extension not enabled' );
} else {
$this->ptRunner->addArticles( $this->ptFileInfo[ 'articles'] );
}
}
}