jquery.textSelection: Implement 'encapsulateSelection' in terms of the other commands
[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
19 use MediaWikiCoversValidator;
20
21 /** @var array */
22 private $ptTest;
23
24 /** @var ParserTestRunner */
25 private $ptRunner;
26
27 /** @var ScopedCallback */
28 private $ptTeardownScope;
29
30 public function __construct( $runner, $fileName, $test ) {
31 parent::__construct( 'testParse', [ '[details omitted]' ],
32 basename( $fileName ) . ': ' . $test['desc'] );
33 $this->ptTest = $test;
34 $this->ptRunner = $runner;
35 }
36
37 public function testParse() {
38 $this->ptRunner->getRecorder()->setTestCase( $this );
39 $result = $this->ptRunner->runTest( $this->ptTest );
40 $this->assertEquals( $result->expected, $result->actual );
41 }
42
43 public function setUp() {
44 $this->ptTeardownScope = $this->ptRunner->staticSetup();
45 }
46
47 public function tearDown() {
48 if ( $this->ptTeardownScope ) {
49 ScopedCallback::consume( $this->ptTeardownScope );
50 }
51 }
52 }