Manual:Parser tests/yo

Each parser test case specifies input wikitext and output HTML, to confirm that things operate as expected. The actual output is compared with the desired result, and thus, the parser test cases (also known as parser tests) can be helpful at spotting regressions.

Awọn ọran idanwo parser n gbe inu iwe ilana. Awọn amugbooro yẹ ki o gbe awọn idanwo wọn sinu iwe ilana.

Wọn le ṣiṣẹ mejeeji nipasẹ suite idanwo phpunit bakanna bi iwe afọwọkọ parserTests.php standalone. Nitorinaa, ikuna idanwo parser yoo fa ikuna idanwo Jenkins kan.

Version 2 format

 * Starting with 1.35, parser tests are required to be in the Version 2 format. Specifying version 2 indicates that the tests are ready to be run in "tidy" mode (See T249138).
 * To indicate your parser tests are run in version 2 format, the first line in your parser test file must be
 * To indicate your parser tests are run in version 2 format, the first line in your parser test file must be

Enabling hooks
Lati le rii daju pe aami itẹsiwaju  ti kojọpọ ṣafikun ni ibẹrẹ faili naa:

Adding articles
In order to create a new article, the syntax is:

Layout of a parser test
Besides the test time, a test has a number of sections:  (optional),   (optional), ,   (optional),   (optional),   (optional),   (optional),   (optional).

The  and the various   sections are only relevant when running a test with Parsoid. Parsoid also allows additional configuration with additional test-specific options in the options section.

Syntax is as follows for a simple test.

Configuration section
Ti o ba pato awọn eto atunto nibẹ, rii daju pe o ko ni aaye funfun eyikeyi laarin awọn ikosile rẹ, nitori pe aaye funfun ko ni gige nipasẹ olusare idanwo.

Options section
Each option should come on its own line.


 * disables the test.
 * runs the test only with the core's default parser unless Parsoid-specific HTML sections are present. The "php" name is a historical remnant from when Parsoid was a Node.js codebase.
 * or  enable Parsoid-specific options.
 * Ex:  runs this test in only those 2 modes. By default, the test is run all available test modes for the test given the wikitext and html sections. In the common case, this defaults to running the test in wt2html, wt2wt, html2wt, html2html, and selser modes. The selser mode is an abbreviation for a test mode where the HTML section is edited in a number of automated ways which is then converted to wikitext using Parsoid's selective-serialization (selser henceforth) transformations. TODO: Add a link to a wikipage that explains Parsoid's various transformations.
 * The JSON object format is commonly used when the tests want to manually specify how the HTML should be edited for testing with Parsoid's selser transformation. This option will need to be paired with a  section in the test (see below)  that specifies the expected wikitxt output when this edited HTML is converted (via selser) to wikitext by Parsoid.

Wikitext sections
TODO

HTML sections
TODO

Extension.json & parser tests
Extensions that place their tests in  and are using extension.json will automatically have their parser tests run. For extensions using the legacy extension loading system, they can use:

Running tests with parserTests.php
To run the parser tests, go to the root directory of your local MediaWiki installation and execute the following from the command line:

To run tests for just one file, use  param. See more params with.

Parsoid-specific test runner options
These options aren't available with MediaWiki core's paresr test runner in MW 1.38 and prior. You can run tests in Parsoid mode via the  option. The best and most up-to-date documentation of all available options is to run

Setting global config variables
To set default global variables for all parser tests in an extension, use the hook.

In a specific test, set the config variables as follows: