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
27 class ParserIntegrationTest
extends PHPUnit_Framework_TestCase
{
29 use MediaWikiCoversValidator
;
34 /** @var ParserTestRunner */
37 /** @var ScopedCallback */
38 private $ptTeardownScope;
40 public function __construct( $runner, $fileName, $test ) {
41 parent
::__construct( 'testParse', [ '[details omitted]' ],
42 basename( $fileName ) . ': ' . $test['desc'] );
43 $this->ptTest
= $test;
44 $this->ptRunner
= $runner;
47 public function testParse() {
48 $this->ptRunner
->getRecorder()->setTestCase( $this );
49 $result = $this->ptRunner
->runTest( $this->ptTest
);
50 $this->assertEquals( $result->expected
, $result->actual
);
53 public function setUp() {
54 $this->ptTeardownScope
= $this->ptRunner
->staticSetup();
57 public function tearDown() {
58 if ( $this->ptTeardownScope
) {
59 ScopedCallback
::consume( $this->ptTeardownScope
);