Warn if stateful ParserOutput transforms are used
[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 * @todo covers tags
16 */
17 class ParserIntegrationTest extends PHPUnit_Framework_TestCase {
18 /** @var array */
19 private $ptTest;
20
21 /** @var ParserTestRunner */
22 private $ptRunner;
23
24 /** @var ScopedCallback */
25 private $ptTeardownScope;
26
27 public function __construct( $runner, $fileName, $test ) {
28 parent::__construct( 'testParse', [ '[details omitted]' ],
29 basename( $fileName ) . ': ' . $test['desc'] );
30 $this->ptTest = $test;
31 $this->ptRunner = $runner;
32 }
33
34 public function testParse() {
35 $this->ptRunner->getRecorder()->setTestCase( $this );
36 $result = $this->ptRunner->runTest( $this->ptTest );
37 $this->assertEquals( $result->expected, $result->actual );
38 }
39
40 public function setUp() {
41 $this->ptTeardownScope = $this->ptRunner->staticSetup();
42 }
43
44 public function tearDown() {
45 if ( $this->ptTeardownScope ) {
46 ScopedCallback::consume( $this->ptTeardownScope );
47 }
48 }
49 }