wiki.techinc.nl/tests/phpunit/suites/ParserIntegrationTest.php
Umherirrender a3a9cf99cb tests: Use namespaced class names in @covers annotations
Assist from 8c9cb701e56226cac43fee2fa24b0d0e586f1733

Change-Id: I47897c499028d9e24c00ad0bc6ba7fd8002d9bc1
2024-01-27 01:11:07 +01:00

70 lines
1.9 KiB
PHP

<?php
use Wikimedia\Parsoid\ParserTests\Test as ParserTest;
use Wikimedia\Parsoid\ParserTests\TestMode as ParserTestMode;
/**
* This is the TestCase subclass for running a single parser test via the
* ParserTestRunner integration test system.
*
* Note: the following groups are not used by PHPUnit.
* The list in ParserTestFileSuite::__construct() is used instead.
*
* @group large
* @group Database
* @group Parser
* @group ParserTests
*
* @covers Parser
* @covers BlockLevelPass
* @covers CoreParserFunctions
* @covers CoreTagHooks
* @covers MediaWiki\Parser\Sanitizer
* @covers Preprocessor
* @covers Preprocessor_Hash
* @covers DateFormatter
* @covers LinkHolderArray
* @covers StripState
* @covers ParserOptions
* @covers \MediaWiki\Parser\ParserOutput
*/
class ParserIntegrationTest extends PHPUnit\Framework\TestCase {
use MediaWikiCoversValidator;
use MediaWikiTestCaseTrait;
/** @var ParserTest */
private $ptTest;
/** @var ParserTestMode */
private $ptMode;
/** @var ParserTestRunner */
private $ptRunner;
/** @var string|null */
private $skipMessage;
public function __construct( $runner, $fileName, ParserTest $test, ParserTestMode $mode, $skipMessage = null ) {
parent::__construct( 'testParse',
[ "$mode" ],
basename( $fileName ) . ': ' . $test->testName );
$this->ptTest = $test;
$this->ptMode = $mode;
$this->ptRunner = $runner;
$this->skipMessage = $skipMessage;
}
public function testParse() {
if ( $this->skipMessage !== null ) {
$this->markTestSkipped( $this->skipMessage );
}
$this->ptRunner->getRecorder()->setTestCase( $this );
$result = $this->ptRunner->runTest( $this->ptTest, $this->ptMode );
if ( $result === false ) {
// Test intentionally skipped.
$result = new ParserTestResult( $this->ptTest, $this->ptMode, "SKIP", "SKIP" );
}
$this->assertEquals( $result->expected, $result->actual );
}
}