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.
17 * @covers BlockLevelPass
18 * @covers CoreParserFunctions
19 * @covers CoreTagHooks
21 * @covers Preprocessor
22 * @covers Preprocessor_DOM
23 * @covers Preprocessor_Hash
24 * @covers DateFormatter
25 * @covers LinkHolderArray
27 * @covers ParserOptions
28 * @covers ParserOutput
30 class ParserIntegrationTest
extends PHPUnit\Framework\TestCase
{
32 use MediaWikiCoversValidator
;
37 /** @var ParserTestRunner */
40 /** @var ScopedCallback */
41 private $ptTeardownScope;
43 public function __construct( $runner, $fileName, $test ) {
44 parent
::__construct( 'testParse', [ '[details omitted]' ],
45 basename( $fileName ) . ': ' . $test['desc'] );
46 $this->ptTest
= $test;
47 $this->ptRunner
= $runner;
50 public function testParse() {
51 $this->ptRunner
->getRecorder()->setTestCase( $this );
52 $result = $this->ptRunner
->runTest( $this->ptTest
);
53 $this->assertEquals( $result->expected
, $result->actual
);
56 public function setUp() {
57 $this->ptTeardownScope
= $this->ptRunner
->staticSetup();
60 public function tearDown() {
61 if ( $this->ptTeardownScope
) {
62 ScopedCallback
::consume( $this->ptTeardownScope
);