Merge "Add SPARQL client to core"
[lhc/web/wiklou.git] / tests / phpunit / includes / parser / 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 Database
12 * @group Parser
13 * @group ParserTests
14 *
15 * @covers Parser
16 * @covers BlockLevelPass
17 * @covers CoreParserFunctions
18 * @covers CoreTagHooks
19 * @covers Sanitizer
20 * @covers Preprocessor
21 * @covers Preprocessor_DOM
22 * @covers Preprocessor_Hash
23 * @covers DateFormatter
24 * @covers LinkHolderArray
25 * @covers StripState
26 * @covers ParserOptions
27 * @covers ParserOutput
28 */
29 class ParserIntegrationTest extends PHPUnit_Framework_TestCase {
30
31 use MediaWikiCoversValidator;
32
33 /** @var array */
34 private $ptTest;
35
36 /** @var ParserTestRunner */
37 private $ptRunner;
38
39 /** @var ScopedCallback */
40 private $ptTeardownScope;
41
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;
47 }
48
49 public function testParse() {
50 $this->ptRunner->getRecorder()->setTestCase( $this );
51 $result = $this->ptRunner->runTest( $this->ptTest );
52 $this->assertEquals( $result->expected, $result->actual );
53 }
54
55 public function setUp() {
56 $this->ptTeardownScope = $this->ptRunner->staticSetup();
57 }
58
59 public function tearDown() {
60 if ( $this->ptTeardownScope ) {
61 ScopedCallback::consume( $this->ptTeardownScope );
62 }
63 }
64 }