From 02d13afa7e76203ecc0965bb089f3b3e616f82ab Mon Sep 17 00:00:00 2001 From: "C. Scott Ananian" Date: Fri, 12 Aug 2022 14:36:56 -0400 Subject: [PATCH] Allow parsoid-compatible parser tests to select a subset of parsoid modes This lets you tag a parser test file with: !! options parsoid-compatible=wt2html !! end to indicate that you want to run only the parsoid wt2html tests on this file. This is especially useful when gradually adding integrated-mode parsoid output clauses to an existing test file. Change-Id: Id870d23da3c127fea61d6b8ab98200c0e4c661e2 --- tests/phpunit/suites/ParsoidTestFileSuite.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/phpunit/suites/ParsoidTestFileSuite.php b/tests/phpunit/suites/ParsoidTestFileSuite.php index c9f191e883a..7e84039de61 100644 --- a/tests/phpunit/suites/ParsoidTestFileSuite.php +++ b/tests/phpunit/suites/ParsoidTestFileSuite.php @@ -49,6 +49,14 @@ class ParsoidTestFileSuite extends TestSuite { $validTestModes = $this->ptRunner->getRequestedTestModes(); $skipMode = new ParserTestMode( $validTestModes[0] ); + $modeRestriction = $this->ptFileInfo->fileOptions['parsoid-compatible'] ?? false; + if ( $modeRestriction !== false ) { + if ( is_string( $modeRestriction ) ) { + // shorthand + $modeRestriction = [ $modeRestriction ]; + } + $validTestModes = array_intersect( $validTestModes, $modeRestriction ); + } $suite = $this; foreach ( $this->ptFileInfo->testCases as $t ) {