2 use Wikimedia\ScopedCallback
;
5 * This is the TestCase subclass for running a single parser test via the
6 * ParserTestRunner integration test system.
8 * Note: the following groups are not used by PHPUnit.
9 * The list in ParserTestFileSuite::__construct() is used instead.
17 class ParserIntegrationTest
extends PHPUnit_Framework_TestCase
{
21 /** @var ParserTestRunner */
24 /** @var ScopedCallback */
25 private $ptTeardownScope;
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;
34 public function testParse() {
35 $this->ptRunner
->getRecorder()->setTestCase( $this );
36 $result = $this->ptRunner
->runTest( $this->ptTest
);
37 $this->assertEquals( $result->expected
, $result->actual
);
40 public function setUp() {
41 $this->ptTeardownScope
= $this->ptRunner
->staticSetup();
44 public function tearDown() {
45 if ( $this->ptTeardownScope
) {
46 ScopedCallback
::consume( $this->ptTeardownScope
);