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