Improve return types in class MagicWordArray
[lhc/web/wiklou.git] / tests / phpunit / suites / ParserIntegrationTest.php
1 <?php
2 use Wikimedia\ScopedCallback;
3
4 /**
5 * This is the TestCase subclass for running a single parser test via the
6 * ParserTestRunner integration test system.
7 *
8 * Note: the following groups are not used by PHPUnit.
9 * The list in ParserTestFileSuite::__construct() is used instead.
10 *
11 * @group large
12 * @group Database
13 * @group Parser
14 * @group ParserTests
15 *
16 * @covers Parser
17 * @covers BlockLevelPass
18 * @covers CoreParserFunctions
19 * @covers CoreTagHooks
20 * @covers Sanitizer
21 * @covers Preprocessor
22 * @covers Preprocessor_DOM
23 * @covers Preprocessor_Hash
24 * @covers DateFormatter
25 * @covers LinkHolderArray
26 * @covers StripState
27 * @covers ParserOptions
28 * @covers ParserOutput
29 */
30 class ParserIntegrationTest extends PHPUnit\Framework\TestCase {
31
32 use MediaWikiCoversValidator;
33
34 /** @var array */
35 private $ptTest;
36
37 /** @var ParserTestRunner */
38 private $ptRunner;
39
40 /** @var ScopedCallback */
41 private $ptTeardownScope;
42
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;
48 }
49
50 public function testParse() {
51 $this->ptRunner->getRecorder()->setTestCase( $this );
52 $result = $this->ptRunner->runTest( $this->ptTest );
53 $this->assertEquals( $result->expected, $result->actual );
54 }
55
56 public function setUp() {
57 $this->ptTeardownScope = $this->ptRunner->staticSetup();
58 }
59
60 public function tearDown() {
61 if ( $this->ptTeardownScope ) {
62 ScopedCallback::consume( $this->ptTeardownScope );
63 }
64 }
65 }