Parsoid
A bidirectional parser between wikitext and HTML5
|
Test runner for parser tests. More...
Public Member Functions | |
__construct (string $testFilePath, ?string $knownFailuresInfix, array $modes) | |
run (array $options) | |
Run parser tests for the file with the provided options. | |
Test runner for parser tests.
Wikimedia\Parsoid\ParserTests\TestRunner::__construct | ( | string | $testFilePath, |
?string | $knownFailuresInfix, | ||
array | $modes ) |
string | $testFilePath | |
?string | $knownFailuresInfix | |
string[] | $modes |
Wikimedia\Parsoid\ParserTests\TestRunner::run | ( | array | $options | ) |
Run parser tests for the file with the provided options.
array | $options |
PORT-FIXME(T238722) // Enable sampling to assert it's working while testing. $parsoidConfig->loggerSampling = [ [ '/^warn(\/|$)/', 100 ] ];
// Override env's setLogger
to record if we see fatal
or error
// while running parser tests. (Keep it clean, folks! Use // "suppressError" option on the test if error is expected.) $env->setLogger = ( ( function ( $parserTests, $superSetLogger ) { return function ( $_logger ) use ( &$parserTests ) { call_user_func( 'superSetLogger', $_logger ); $this->log = function ( $level ) use ( &$_logger, &$parserTests ) { if ( $_logger !== $parserTests->suppressLogger && preg_match( '/^(fatal|error)/', $level ) ) { $parserTests->stats->loggedErrorCount++; } return call_user_func_array( [ $_logger, 'log' ], $arguments ); }; }; } ) );