3 use Wikimedia\ScopedCallback
;
6 * This is the TestCase subclass for running a single parser test via the
7 * ParserTestRunner integration test system.
9 * Note: the following groups are not used by PHPUnit.
10 * The list in ParserTestFileSuite::__construct() is used instead.
18 * @covers BlockLevelPass
19 * @covers CoreParserFunctions
20 * @covers CoreTagHooks
22 * @covers Preprocessor
23 * @covers Preprocessor_DOM
24 * @covers Preprocessor_Hash
25 * @covers DateFormatter
26 * @covers LinkHolderArray
28 * @covers ParserOptions
29 * @covers ParserOutput
31 class ParserIntegrationTest
extends PHPUnit\Framework\TestCase
{
33 use MediaWikiCoversValidator
;
38 /** @var ParserTestRunner */
41 /** @var ScopedCallback */
42 private $ptTeardownScope;
44 public function __construct( $runner, $fileName, $test ) {
45 parent
::__construct( 'testParse', [ '[details omitted]' ],
46 basename( $fileName ) . ': ' . $test['desc'] );
47 $this->ptTest
= $test;
48 $this->ptRunner
= $runner;
51 public function testParse() {
52 $this->ptRunner
->getRecorder()->setTestCase( $this );
53 $result = $this->ptRunner
->runTest( $this->ptTest
);
54 $this->assertEquals( $result->expected
, $result->actual
);
57 public function setUp() {
58 $this->ptTeardownScope
= $this->ptRunner
->staticSetup();
61 public function tearDown() {
62 if ( $this->ptTeardownScope
) {
63 ScopedCallback
::consume( $this->ptTeardownScope
);