Represents a parser test.
More...
|
| __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.
|
|
| normalizeWT (string $actual, string $expected, bool $standalone=true) |
| Normalize expected and actual wikitext to suppress irrelevant differences.
|
|
| __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.
|
|
|
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' |
|
| $type |
|
| $filename |
|
| $lineNumStart |
|
| $lineNumEnd |
|
| $comment |
|
Represents a parser test.
◆ __construct()
Wikimedia\Parsoid\ParserTests\Test::__construct |
( |
array | $testProperties, |
|
|
array | $knownFailures = [], |
|
|
?string | $comment = null, |
|
|
?callable | $warnFunc = null ) |
- Parameters
-
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. |
◆ applyChanges()
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.
- Parameters
-
array | $dumpOpts | |
Document | $doc | |
array | $changelist | |
◆ applyManualChanges()
Wikimedia\Parsoid\ParserTests\Test::applyManualChanges |
( |
Document | $doc | ) |
|
Apply manually-specified changes, which are provided in a pseudo-jQuery format.
- Parameters
-
◆ computeTestModes()
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.
- Parameters
-
array | $testRunnerModes | What test modes is the test runner running with? |
- Returns
- array
◆ generateChanges()
Wikimedia\Parsoid\ParserTests\Test::generateChanges |
( |
Document | $doc | ) |
|
Generate a change object for a document, so we can apply it during a selser test.
- Parameters
-
- Returns
- array The list of changes.
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.
◆ isDuplicateChangeTree()
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.
- Parameters
-
array | $change | Candidate change. |
- Returns
- bool
◆ matchesFilter()
Wikimedia\Parsoid\ParserTests\Test::matchesFilter |
( |
| $testFilter | ) |
|
- Parameters
-
array | $testFilter | Test Filter as set in TestRunner |
- Returns
- bool if test matches the filter
◆ normalizeHTML()
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.
- Parameters
-
Element | string | $actual | |
?string | $normExpected | |
bool | $standalone | |
- Returns
- array
◆ normalizeWT()
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
- Parameters
-
string | $actual | |
string | $expected | |
bool | $standalone | |
- Returns
- array
◆ testAllModes()
Wikimedia\Parsoid\ParserTests\Test::testAllModes |
( |
array | $targetModes, |
|
|
array | $runnerOpts, |
|
|
callable | $runTest ) |
FIXME: clean up this mess!
- generate all changes at once (generateChanges should return a tree really) rather than going to all these lengths of interleaving change generation with tests
- set up the changes in item directly rather than juggling around with indexes etc
- indicate whether to compare to wt2wt or the original input
- maybe make a full selser test one method that uses others rather than the current chain of methods that sometimes do something for selser
- Parameters
-
array | $targetModes | |
array | $runnerOpts | |
callable | $runTest | |
The documentation for this class was generated from the following file: