Represents a parser test mode, that is, a certain way of executing a parser tests and evaluating the result.
More...
|
| __construct (string $mode, ?array $changetree=null) |
| Create a new test mode.
|
|
| isLegacy () |
| Helper function: returns true if this test mode is 'legacy'; that is, is this test to run with the legacy parser.
|
|
| isCachingMode () |
| Helper function: returns true if we are running this test to cache some info for use in later tests.
|
|
| __toString () |
| Returns a string representation of this test mode, which can also be used as an array key or for human-friendly output.
|
|
|
static | requestedTestModes (array $options, bool $ifEmptySetAll=true) |
| Helper function: filter a given set of options against the TEST_MODES.
|
|
|
const | TEST_MODES |
| Valid test modes, as keys for efficient query/set intersection.
|
|
| $mode |
|
| $changetree |
|
Represents a parser test mode, that is, a certain way of executing a parser tests and evaluating the result.
As a trivial example, a parser test will typically have a "wikitext" section and an "html" section. Two possible modes for evaluating the test are "wt2html" (where you programatically convert the "wikitext" section to HTML and verify that the result matches the "html" section, after normalization) and "html2wt" (where you programmatically convert the "html" section back to wikitext and verify that the result matches the "wikitext" section, after normalization).
◆ __construct()
Wikimedia\Parsoid\ParserTests\TestMode::__construct |
( |
string | $mode, |
|
|
?array | $changetree = null ) |
Create a new test mode.
- Parameters
-
string | $mode | The test mode. An external caller should use one of self::TEST_MODES , although ParserTestRunner uses a few additional values internally. |
?array | $changetree | The specific changes to apply in selser test mode. |
◆ __toString()
Wikimedia\Parsoid\ParserTests\TestMode::__toString |
( |
| ) |
|
Returns a string representation of this test mode, which can also be used as an array key or for human-friendly output.
- Returns
- string
◆ isCachingMode()
Wikimedia\Parsoid\ParserTests\TestMode::isCachingMode |
( |
| ) |
|
Helper function: returns true if we are running this test to cache some info for use in later tests.
- Returns
- bool
◆ isLegacy()
Wikimedia\Parsoid\ParserTests\TestMode::isLegacy |
( |
| ) |
|
Helper function: returns true if this test mode is 'legacy'; that is, is this test to run with the legacy parser.
- Returns
- bool
◆ requestedTestModes()
static Wikimedia\Parsoid\ParserTests\TestMode::requestedTestModes |
( |
array | $options, |
|
|
bool | $ifEmptySetAll = true ) |
|
static |
Helper function: filter a given set of options against the TEST_MODES.
Optionally ensure that all modes are returned if none are explicitly set.
- Parameters
-
string[] | $options | The user-specified test modes |
bool | $ifEmptySetAll | If true, ensure that the result always includes at least one set test mode by setting all available test modes if the passed $options array does not contain any. |
- Returns
- string[] A filtered set of test modes
◆ TEST_MODES
const Wikimedia\Parsoid\ParserTests\TestMode::TEST_MODES |
Initial value:= [
'legacy' => true,
'wt2html' => true,
'wt2wt' => true,
'html2html' => true,
'html2wt' => true,
'selser' => true,
]
Valid test modes, as keys for efficient query/set intersection.
The documentation for this class was generated from the following file:
- src/ParserTests/TestMode.php