MediaWiki
REL1_22
|
Although marked as a stub, can work independently. More...
Public Member Functions | |
addArticle ($name, $text, $line) | |
addDBData () | |
Stub. | |
getFuzzInput ($filenames) | |
Get an input dictionary from a set of parser test files. | |
getMemoryBreakdown () | |
Get a memory usage breakdown. | |
getParser ($preprocessor=null) | |
Get a Parser object. | |
parserTestProvider () | |
publishTestArticles () | |
removeEndingNewline ($s) | |
Remove last character if it is a newline. | |
requireFunctionHook ($name) | |
requireHook ($name) | |
Steal a callback function from the primary parser, save it for application to our scary parser. | |
setParserTestFile ($filename) | |
Set the file from whose tests will be run by this instance. | |
testFuzzTests () | |
Run a fuzz test series Draw input from a set of test files. | |
testParserTest ($desc, $input, $result, $opts, $config) | |
medium parserTestProvider | |
Static Public Member Functions | |
static | setUpBeforeClass () |
static | tearDownAfterClass () |
Public Attributes | |
$functionHooks = array() | |
$fuzzSeed = 0 | |
$hooks = array() | |
$keepUploads = false | |
$maxFuzzTestLength = 300 | |
$memoryLimit = 50 | |
$regex = '' | |
$runDisabled = false | |
$runParsoid = false | |
$savedGlobals = array() | |
$savedWeirdGlobals = array() | |
$showProgress = true | |
Protected Member Functions | |
cleanupOption ($opt) | |
getBaseDir () | |
getUploadDir () | |
Get an FS upload directory (only applies to FSFileBackend) | |
parseOptions ($instring) | |
setUp () | |
setUp and tearDown should (where significant) happen in reverse order. | |
setupGlobals ($opts=array(), $config= '') | |
Set up the global variables for a consistent environment for each test. | |
setupUploads () | |
Create a dummy uploads directory which will contain a couple of files in order to pass existence tests. | |
tearDown () | |
teardownGlobals () | |
Restore default values and perform any necessary clean-up after each test runs. | |
tidy ($text) | |
Run the "tidy" command on text if the $wgUseTidy global is true. | |
Static Protected Member Functions | |
static | getOptionValue ($key, $opts, $default) |
Use a regex to find out the value of an option. | |
Protected Attributes | |
$file = false | |
Static Protected Attributes | |
static | $articles = array() |
static | $backendToUse |
Private Member Functions | |
teardownUploads () | |
Remove the dummy uploads directory. | |
Static Private Member Functions | |
static | deleteFiles ($files) |
Delete the specified files, if they exist. |
Although marked as a stub, can work independently.
Database Parser Stub
Definition at line 12 of file NewParserTest.php.
NewParserTest::addArticle | ( | $ | name, |
$ | text, | ||
$ | line | ||
) |
Definition at line 819 of file NewParserTest.php.
References $name, and array().
Referenced by publishTestArticles().
Stub.
If a test needs to add additional data to the database, it should implement this method and do so
Reimplemented from MediaWikiTestCase.
Definition at line 180 of file NewParserTest.php.
References $user, array(), at, failure, Title\makeTitle(), User\newFromId(), LinkCache\singleton(), wfBaseConvert(), and wfLocalFile().
NewParserTest::cleanupOption | ( | $ | opt | ) | [protected] |
Definition at line 942 of file NewParserTest.php.
Referenced by parseOptions().
static NewParserTest::deleteFiles | ( | $ | files | ) | [static, private] |
Delete the specified files, if they exist.
$files | Array: full paths to files to delete. |
Definition at line 529 of file NewParserTest.php.
References $file, $files, array(), as, FileBackend\parentStoragePath(), and RepoGroup\singleton().
Referenced by teardownUploads().
NewParserTest::getBaseDir | ( | ) | [protected] |
Definition at line 544 of file NewParserTest.php.
Referenced by setupUploads(), and teardownUploads().
NewParserTest::getFuzzInput | ( | $ | filenames | ) |
Get an input dictionary from a set of parser test files.
Definition at line 753 of file NewParserTest.php.
Referenced by testFuzzTests().
Get a memory usage breakdown.
Definition at line 771 of file NewParserTest.php.
References $name, $value, array(), and as.
Referenced by testFuzzTests().
static NewParserTest::getOptionValue | ( | $ | key, |
$ | opts, | ||
$ | default | ||
) | [static, protected] |
Use a regex to find out the value of an option.
$key | String: name of option val to retrieve |
$opts | Options array to look in |
$default | Mixed: default value returned if not found |
Definition at line 960 of file NewParserTest.php.
References $key.
Referenced by setupGlobals().
NewParserTest::getParser | ( | $ | preprocessor = null | ) |
Get a Parser object.
Definition at line 806 of file NewParserTest.php.
References $parser, array(), global, and wfRunHooks().
Referenced by testFuzzTests(), and testParserTest().
NewParserTest::getUploadDir | ( | ) | [protected] |
Get an FS upload directory (only applies to FSFileBackend)
Definition at line 403 of file NewParserTest.php.
References $dir, wfDebug(), and wfTempDir().
Referenced by setupGlobals().
NewParserTest::parseOptions | ( | $ | instring | ) | [protected] |
Definition at line 886 of file NewParserTest.php.
References $key, $matches, $regex, array(), as, and cleanupOption().
Referenced by testParserTest().
Definition at line 548 of file NewParserTest.php.
Definition at line 823 of file NewParserTest.php.
References $name, addArticle(), as, empty, and list.
Referenced by setupGlobals().
Remove last character if it is a newline.
Definition at line 876 of file NewParserTest.php.
References $s.
NewParserTest::requireFunctionHook | ( | $ | name | ) |
Definition at line 848 of file NewParserTest.php.
NewParserTest::requireHook | ( | $ | name | ) |
Steal a callback function from the primary parser, save it for application to our scary parser.
If the hook is not installed, abort processing of this file.
$name | String |
Definition at line 842 of file NewParserTest.php.
NewParserTest::setParserTestFile | ( | $ | filename | ) |
Set the file from whose tests will be run by this instance.
Definition at line 560 of file NewParserTest.php.
References file.
NewParserTest::setUp | ( | ) | [protected] |
setUp and tearDown should (where significant) happen in reverse order.
Reimplemented from MediaWikiTestCase.
Definition at line 41 of file NewParserTest.php.
References $IP, $wgContLang, $wgHooks, $wgNamespaceAliases, array(), as, cache, Language\factory(), MWNamespace\getCanonicalNamespaces(), MediaWikiTestCase\getCliArg(), global, and MediaWikiTestCase\setMwGlobals().
static NewParserTest::setUpBeforeClass | ( | ) | [static] |
Definition at line 36 of file NewParserTest.php.
References ParserTest\setupInterwikis().
NewParserTest::setupGlobals | ( | $ | opts = array() , |
$ | config = '' |
||
) | [protected] |
Set up the global variables for a consistent environment for each test.
Ideally this should replace the global configuration entirely.
Definition at line 284 of file NewParserTest.php.
References $backendToUse, $name, $value, array(), as, MagicWord\clearCache(), MessageCache\destroyInstance(), FileBackendGroup\destroySingleton(), RepoGroup\destroySingleton(), Language\factory(), MediaWikiTestCase\getCliArg(), getOptionValue(), getUploadDir(), global, list, publishTestArticles(), setupUploads(), and wfRunHooks().
Referenced by testFuzzTests(), and testParserTest().
NewParserTest::setupUploads | ( | ) | [protected] |
Create a dummy uploads directory which will contain a couple of files in order to pass existence tests.
Definition at line 430 of file NewParserTest.php.
References $IP, array(), getBaseDir(), global, RepoGroup\singleton(), and wfTempDir().
Referenced by setupGlobals().
NewParserTest::tearDown | ( | ) | [protected] |
Reimplemented from MediaWikiTestCase.
Definition at line 153 of file NewParserTest.php.
References $wgContLang, $wgNamespaceAliases, cache, MessageCache\destroyInstance(), FileBackendGroup\destroySingleton(), RepoGroup\destroySingleton(), MWNamespace\getCanonicalNamespaces(), global, and LinkCache\singleton().
static NewParserTest::tearDownAfterClass | ( | ) | [static] |
Definition at line 175 of file NewParserTest.php.
References ParserTest\tearDownInterwikis().
NewParserTest::teardownGlobals | ( | ) | [protected] |
Restore default values and perform any necessary clean-up after each test runs.
Definition at line 466 of file NewParserTest.php.
References as, and teardownUploads().
Referenced by testFuzzTests(), and testParserTest().
NewParserTest::teardownUploads | ( | ) | [private] |
Remove the dummy uploads directory.
Definition at line 477 of file NewParserTest.php.
References array(), deleteFiles(), getBaseDir(), and RepoGroup\singleton().
Referenced by teardownGlobals().
Run a fuzz test series Draw input from a set of test files.
ParserFuzz
Definition at line 676 of file NewParserTest.php.
References $files, $name, $parser, $ret, $title, $user, array(), as, MediaWikiTestCase\getCliArg(), getFuzzInput(), getMemoryBreakdown(), getParser(), global, Title\makeTitle(), ParserOptions\newFromUser(), setupGlobals(), teardownGlobals(), and User.
NewParserTest::testParserTest | ( | $ | desc, |
$ | input, | ||
$ | result, | ||
$ | opts, | ||
$ | config | ||
) |
medium parserTestProvider
Definition at line 568 of file NewParserTest.php.
References $options, $out, $output, $parser, $result, $section, $title, $user, Linker\formatComment(), getParser(), global, MediaWikiTestCase\isWikitextNS(), ParserOptions\newFromContext(), Title\newFromText(), parseOptions(), setupGlobals(), teardownGlobals(), tidy(), and wfDebug().
NewParserTest::tidy | ( | $ | text | ) | [protected] |
Run the "tidy" command on text if the $wgUseTidy global is true.
$text | String: the text to tidy |
Definition at line 863 of file NewParserTest.php.
References global.
Referenced by testParserTest().
NewParserTest::$articles = array() [static, protected] |
Definition at line 13 of file NewParserTest.php.
NewParserTest::$backendToUse [static, protected] |
Definition at line 17 of file NewParserTest.php.
Referenced by setupGlobals().
Definition at line 34 of file NewParserTest.php.
Referenced by deleteFiles().
NewParserTest::$functionHooks = array() |
Definition at line 27 of file NewParserTest.php.
NewParserTest::$fuzzSeed = 0 |
Definition at line 31 of file NewParserTest.php.
Definition at line 26 of file NewParserTest.php.
NewParserTest::$keepUploads = false |
Definition at line 19 of file NewParserTest.php.
NewParserTest::$maxFuzzTestLength = 300 |
Definition at line 30 of file NewParserTest.php.
NewParserTest::$memoryLimit = 50 |
Definition at line 32 of file NewParserTest.php.
NewParserTest::$regex = '' |
Reimplemented from MediaWikiTestCase.
Definition at line 22 of file NewParserTest.php.
Referenced by parseOptions().
NewParserTest::$runDisabled = false |
Reimplemented from MediaWikiTestCase.
Definition at line 20 of file NewParserTest.php.
NewParserTest::$runParsoid = false |
Definition at line 21 of file NewParserTest.php.
NewParserTest::$savedGlobals = array() |
Definition at line 25 of file NewParserTest.php.
NewParserTest::$savedWeirdGlobals = array() |
Definition at line 24 of file NewParserTest.php.
NewParserTest::$showProgress = true |
Definition at line 23 of file NewParserTest.php.