Parsoid
A bidirectional parser between wikitext and HTML5
Loading...
Searching...
No Matches
Wikimedia\Parsoid\ParserTests\TestRunner Class Reference

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.
 

Static Public Member Functions

static getStandaloneMetadataSection (Test $test)
 Return the appropriate metadata section for this test, given that we are running in parsoid "standalone" mode, or 'null' if none is present.
 

Detailed Description

Test runner for parser tests.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Parsoid\ParserTests\TestRunner::__construct ( string $testFilePath,
?string $knownFailuresInfix,
array $modes )
Parameters
string$testFilePath
?string$knownFailuresInfix
string[]$modes

Member Function Documentation

◆ getStandaloneMetadataSection()

static Wikimedia\Parsoid\ParserTests\TestRunner::getStandaloneMetadataSection ( Test $test)
static

Return the appropriate metadata section for this test, given that we are running in parsoid "standalone" mode, or 'null' if none is present.

Parameters
Test$test
Returns
?string The expected metadata for this test

◆ run()

Wikimedia\Parsoid\ParserTests\TestRunner::run ( array $options)

Run parser tests for the file with the provided options.

Parameters
array$options
Returns
array

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 ); }; }; } ) );


The documentation for this class was generated from the following file: