Remove the deprecated Preprocessor_DOM class, which was hard-deprecated in 1.34. This begins to simplify parser configuration and reduce redundant code paths, but I've left two things for cleanup in a future patch: 1. The `preprocessorClass` configuration option to the parser, exposed in `$wgParserConf`, ServiceWiring, ParserFactory, etc. There is no reason for this to be exposed as configurable, but I've left this clean up to a future patch. 2. The `$wgMaxGeneratedPPNodeCount` configuration, exposed also in ParserOptions. Only Preprocessor_DOM calculated this count, and since we are only using Preprocessor_Hash now, this configuration has no effect. But since this value was exposed in ParserOptions and elsewhere, I've deprecated where needed but left this clean up to a future patch. Bug: T204945 Change-Id: I727f003f9a42d0c92bcbcce8a8289d5af6cd1298
69 lines
1.7 KiB
PHP
69 lines
1.7 KiB
PHP
<?php
|
|
|
|
use Wikimedia\ScopedCallback;
|
|
|
|
/**
|
|
* 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 Sanitizer
|
|
* @covers Preprocessor
|
|
* @covers Preprocessor_Hash
|
|
* @covers DateFormatter
|
|
* @covers LinkHolderArray
|
|
* @covers StripState
|
|
* @covers ParserOptions
|
|
* @covers ParserOutput
|
|
*/
|
|
class ParserIntegrationTest extends PHPUnit\Framework\TestCase {
|
|
|
|
use MediaWikiCoversValidator;
|
|
|
|
/** @var array */
|
|
private $ptTest;
|
|
|
|
/** @var ParserTestRunner */
|
|
private $ptRunner;
|
|
|
|
/** @var ScopedCallback */
|
|
private $ptTeardownScope;
|
|
|
|
public function __construct( $runner, $fileName, $test ) {
|
|
parent::__construct( 'testParse', [ '[details omitted]' ],
|
|
basename( $fileName ) . ': ' . $test['desc'] );
|
|
$this->ptTest = $test;
|
|
$this->ptRunner = $runner;
|
|
}
|
|
|
|
public function testParse() {
|
|
$this->ptRunner->getRecorder()->setTestCase( $this );
|
|
$result = $this->ptRunner->runTest( $this->ptTest );
|
|
if ( $result === false ) {
|
|
// Test intentionally skipped.
|
|
$result = new ParserTestResult( $this->ptTest, "SKIP", "SKIP" );
|
|
}
|
|
$this->assertEquals( $result->expected, $result->actual );
|
|
}
|
|
|
|
public function setUp() : void {
|
|
$this->ptTeardownScope = $this->ptRunner->staticSetup();
|
|
}
|
|
|
|
public function tearDown() : void {
|
|
if ( $this->ptTeardownScope ) {
|
|
ScopedCallback::consume( $this->ptTeardownScope );
|
|
}
|
|
}
|
|
}
|