2 use Wikimedia\ScopedCallback
;
5 * This is the TestCase subclass for running a single parser test via the
6 * ParserTestRunner integration test system.
8 * Note: the following groups are not used by PHPUnit.
9 * The list in ParserTestFileSuite::__construct() is used instead.
16 * @covers BlockLevelPass
17 * @covers CoreParserFunctions
18 * @covers CoreTagHooks
20 * @covers Preprocessor
21 * @covers Preprocessor_DOM
22 * @covers Preprocessor_Hash
23 * @covers DateFormatter
24 * @covers LinkHolderArray
26 * @covers ParserOptions
27 * @covers ParserOutput
29 class ParserIntegrationTest
extends PHPUnit\Framework\TestCase
{
31 use MediaWikiCoversValidator
;
36 /** @var ParserTestRunner */
39 /** @var ScopedCallback */
40 private $ptTeardownScope;
42 public function __construct( $runner, $fileName, $test ) {
43 parent
::__construct( 'testParse', [ '[details omitted]' ],
44 basename( $fileName ) . ': ' . $test['desc'] );
45 $this->ptTest
= $test;
46 $this->ptRunner
= $runner;
49 public function testParse() {
50 $this->ptRunner
->getRecorder()->setTestCase( $this );
51 $result = $this->ptRunner
->runTest( $this->ptTest
);
52 $this->assertEquals( $result->expected
, $result->actual
);
55 public function setUp() {
56 $this->ptTeardownScope
= $this->ptRunner
->staticSetup();
59 public function tearDown() {
60 if ( $this->ptTeardownScope
) {
61 ScopedCallback
::consume( $this->ptTeardownScope
);