Parsoid
A bidirectional parser between wikitext and HTML5
|
Represents a parser test. More...
Public Member Functions | |
__construct (array $testProperties, array $knownFailures=[], ?string $comment=null, ?callable $warnFunc=null) | |
matchesFilter ( $testFilter) | |
pageName () | |
computeTestModes (array $testRunnerModes) | |
Given a test runner that runs in a specific set of test modes ($testRunnerModes) compute the list of valid test modes based on what modes have been enabled on the test itself. | |
applyManualChanges (Document $doc) | |
Apply manually-specified changes, which are provided in a pseudo-jQuery format. | |
applyChanges (array $dumpOpts, Document $doc, array $changelist) | |
Make changes to a DOM in order to run a selser test on it. | |
isDuplicateChangeTree (array $change) | |
For a selser test, check if a change we could make has already been tested in this round. | |
generateChanges (Document $doc) | |
Generate a change object for a document, so we can apply it during a selser test. | |
testAllModes (array $targetModes, array $runnerOpts, callable $runTest) | |
FIXME: clean up this mess! | |
normalizeHTML ( $actual, ?string $normExpected, bool $standalone=true) | |
Normalize expected and actual HTML to suppress irrelevant differences. | |
normalizeKnownFailure (string $out) | |
Normalize "known failure" output. | |
normalizeWT (string $actual, string $expected, bool $standalone=true) | |
Normalize expected and actual wikitext to suppress irrelevant differences. | |
Public Member Functions inherited from Wikimedia\Parsoid\ParserTests\Item | |
__construct (array $props, ?string $comment=null) | |
errorMsg (string $desc, ?string $text=null) | |
Return a friendly error message related to this item. | |
error (string $desc, ?string $text=null) | |
Throw an error related to this item. | |
Public Attributes | |
const | ALL_TEST_MODES = [ 'wt2html', 'wt2wt', 'html2html', 'html2wt', 'selser' ] |
$testName = null | |
$options = [] | |
$config = [] | |
$sections = [] | |
$knownFailures = [] | |
$wikitext = null | |
$parsoidHtml = null | |
$legacyHtml = null | |
$selserChangeTrees = [] | |
$changetree = null | |
$duplicateChange = false | |
$seed = null | |
$resultWT = null | |
$wt2wtPassed = null | |
$wt2wtResult = null | |
$selser = null | |
$changedHTMLStr = null | |
$cachedBODYstr = null | |
$cachedWTstr = null | |
$cachedNormalizedHTML = null | |
$time = [] | |
const | STATIC_RANDOM_STRING = 'ahseeyooxooZ8Oon0boh' |
Public Attributes inherited from Wikimedia\Parsoid\ParserTests\Item | |
$type | |
$filename | |
$lineNumStart | |
$lineNumEnd | |
$comment | |
Represents a parser test.
Wikimedia\Parsoid\ParserTests\Test::__construct | ( | array | $testProperties, |
array | $knownFailures = [], | ||
?string | $comment = null, | ||
?callable | $warnFunc = null ) |
array | $testProperties | key-value mapping of properties |
array | $knownFailures | Known failures for this test, indexed by testing mode |
?string | $comment | Optional comment describing the test |
?callable | $warnFunc | Optional callback used to emit deprecation warnings. |
Wikimedia\Parsoid\ParserTests\Test::applyChanges | ( | array | $dumpOpts, |
Document | $doc, | ||
array | $changelist ) |
Make changes to a DOM in order to run a selser test on it.
array | $dumpOpts | |
Document | $doc | |
array | $changelist |
Wikimedia\Parsoid\ParserTests\Test::applyManualChanges | ( | Document | $doc | ) |
Apply manually-specified changes, which are provided in a pseudo-jQuery format.
Document | $doc |
Wikimedia\Parsoid\ParserTests\Test::computeTestModes | ( | array | $testRunnerModes | ) |
Given a test runner that runs in a specific set of test modes ($testRunnerModes) compute the list of valid test modes based on what modes have been enabled on the test itself.
array | $testRunnerModes | What test modes is the test runner running with? |
Wikimedia\Parsoid\ParserTests\Test::generateChanges | ( | Document | $doc | ) |
Generate a change object for a document, so we can apply it during a selser test.
Document | $doc |
If no node in the DOM subtree rooted at 'node' is editable in the VE, this function should return false.
Currently true for template and extension content, and for entities.
Even if a DOM subtree might be editable in the VE, certain nodes in the DOM might not be directly editable.
Currently, this restriction is only applied to DOMs generated for images. Possibly, there are other candidates.
Wikimedia\Parsoid\ParserTests\Test::isDuplicateChangeTree | ( | array | $change | ) |
For a selser test, check if a change we could make has already been tested in this round.
Used for generating unique tests.
array | $change | Candidate change. |
Wikimedia\Parsoid\ParserTests\Test::matchesFilter | ( | $testFilter | ) |
array | $testFilter | Test Filter as set in TestRunner |
Wikimedia\Parsoid\ParserTests\Test::normalizeHTML | ( | $actual, | |
?string | $normExpected, | ||
bool | $standalone = true ) |
Normalize expected and actual HTML to suppress irrelevant differences.
The normalization is determined by the HTML sections present in the test as well as other Parsoid-specific test options.
Element | string | $actual | |
?string | $normExpected | |
bool | $standalone |
Wikimedia\Parsoid\ParserTests\Test::normalizeKnownFailure | ( | string | $out | ) |
Normalize "known failure" output.
This is an extremely light normalization, since the point of the known failure file is to catch changes in output, even if we don't know what "correct" is. But we do remove 'about' numbering, since that is not guaranteed consistent from run to run.
Wikimedia\Parsoid\ParserTests\Test::normalizeWT | ( | string | $actual, |
string | $expected, | ||
bool | $standalone = true ) |
Normalize expected and actual wikitext to suppress irrelevant differences.
Because of selser as well as manual edit trees, expected wikitext isn't always found in the same section for all tests ending in WT (unlike normalizeHTML). Hence, (a) this code has a different structure than normalizeHTML (b) we cannot cache normalized wikitext
string | $actual | |
string | $expected | |
bool | $standalone |
Wikimedia\Parsoid\ParserTests\Test::testAllModes | ( | array | $targetModes, |
array | $runnerOpts, | ||
callable | $runTest ) |
FIXME: clean up this mess!
array | $targetModes | |
array | $runnerOpts | |
callable | $runTest |