MediaWiki
REL1_19
|
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. | |
setUp () | |
tearDown () | |
testFuzzTests () | |
Run a fuzz test series Draw input from a set of test files. | |
testParserTest ($desc, $input, $result, $opts, $config) | |
medium parserTestProvider | |
Public Attributes | |
$functionHooks = array() | |
$fuzzSeed = 0 | |
$hooks = array() | |
$keepUploads = false | |
$maxFuzzTestLength = 300 | |
$memoryLimit = 50 | |
$regex = '' | |
$runDisabled = false | |
$savedGlobals = array() | |
$savedInitialGlobals = array() | |
$savedWeirdGlobals = array() | |
$showProgress = true | |
Protected Member Functions | |
cleanupOption ($opt) | |
getBaseDir () | |
getUploadDir () | |
Get an FS upload directory (only applies to FSFileBackend) | |
parseOptions ($instring) | |
setupGlobals ($opts= '', $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. | |
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.
Definition at line 10 of file NewParserTest.php.
NewParserTest::addArticle | ( | $ | name, |
$ | text, | ||
$ | line | ||
) |
Definition at line 745 of file NewParserTest.php.
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 119 of file NewParserTest.php.
References $user, Language\getLocalisationCache(), Title\makeTitle(), User\newFromId(), LinkCache\singleton(), MessageCache\singleton(), wfBaseConvert(), and wfLocalFile().
NewParserTest::cleanupOption | ( | $ | opt | ) | [protected] |
Definition at line 867 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 479 of file NewParserTest.php.
References $file, $files, FileBackend\parentStoragePath(), and RepoGroup\singleton().
Referenced by teardownUploads().
NewParserTest::getBaseDir | ( | ) | [protected] |
Definition at line 494 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 679 of file NewParserTest.php.
References $matches.
Referenced by testFuzzTests().
Get a memory usage breakdown.
Definition at line 697 of file NewParserTest.php.
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 884 of file NewParserTest.php.
Referenced by setupGlobals().
NewParserTest::getParser | ( | $ | preprocessor = null | ) |
Get a Parser object.
Definition at line 732 of file NewParserTest.php.
References $wgParserConf, and wfRunHooks().
Referenced by testFuzzTests(), and testParserTest().
NewParserTest::getUploadDir | ( | ) | [protected] |
Get an FS upload directory (only applies to FSFileBackend)
Definition at line 393 of file NewParserTest.php.
References $dir, wfDebug(), and wfTempDir().
Referenced by setupGlobals().
NewParserTest::parseOptions | ( | $ | instring | ) | [protected] |
Definition at line 812 of file NewParserTest.php.
References $matches, $regex, and cleanupOption().
Referenced by testParserTest().
Definition at line 498 of file NewParserTest.php.
References $wgParserTestFiles.
Definition at line 749 of file NewParserTest.php.
References addArticle().
Referenced by setupGlobals().
Remove last character if it is a newline.
Definition at line 801 of file NewParserTest.php.
NewParserTest::requireFunctionHook | ( | $ | name | ) |
Definition at line 774 of file NewParserTest.php.
References $wgParser.
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 768 of file NewParserTest.php.
References $wgParser.
NewParserTest::setParserTestFile | ( | $ | filename | ) |
Set the file from whose tests will be run by this instance.
Definition at line 509 of file NewParserTest.php.
Definition at line 34 of file NewParserTest.php.
References $IP, $wgContLang, $wgHooks, $wgNamespaceAliases, $wgNamespaceProtection, Language\factory(), MediaWikiTestCase\getCliArg(), wfGetMainCache(), wfGetMessageCacheStorage(), and wfGetParserCacheStorage().
NewParserTest::setupGlobals | ( | $ | opts = '' , |
$ | 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 236 of file NewParserTest.php.
References $backendToUse, $wgFileBackends, $wgHooks, MagicWord\clearCache(), FileBackendGroup\destroySingleton(), RepoGroup\destroySingleton(), Language\factory(), MediaWikiTestCase\getCliArg(), getOptionValue(), getUploadDir(), publishTestArticles(), setupUploads(), and MessageCache\singleton().
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 419 of file NewParserTest.php.
References $IP, getBaseDir(), and RepoGroup\singleton().
Referenced by setupGlobals().
Definition at line 103 of file NewParserTest.php.
References $wgNamespaceAliases, $wgNamespaceProtection, FileBackendGroup\destroySingleton(), and RepoGroup\destroySingleton().
NewParserTest::teardownGlobals | ( | ) | [protected] |
Restore default values and perform any necessary clean-up after each test runs.
Definition at line 438 of file NewParserTest.php.
References RepoGroup\destroySingleton(), LinkCache\singleton(), and teardownUploads().
Referenced by testFuzzTests(), and testParserTest().
NewParserTest::teardownUploads | ( | ) | [private] |
Remove the dummy uploads directory.
Definition at line 452 of file NewParserTest.php.
References deleteFiles(), and getBaseDir().
Referenced by teardownGlobals().
Run a fuzz test series Draw input from a set of test files.
ParserFuzz
Definition at line 603 of file NewParserTest.php.
References $files, $input, $title, $user, $wgParserTestFiles, MediaWikiTestCase\getCliArg(), getFuzzInput(), getMemoryBreakdown(), getParser(), Title\makeTitle(), ParserOptions\newFromUser(), setupGlobals(), and teardownGlobals().
NewParserTest::testParserTest | ( | $ | desc, |
$ | input, | ||
$ | result, | ||
$ | opts, | ||
$ | config | ||
) |
medium parserTestProvider
Definition at line 517 of file NewParserTest.php.
References $input, $options, $out, $output, $result, $section, $title, $user, Linker\formatComment(), getParser(), 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 788 of file NewParserTest.php.
References $wgUseTidy.
Referenced by testParserTest().
NewParserTest::$articles = array() [static, protected] |
Definition at line 11 of file NewParserTest.php.
NewParserTest::$backendToUse [static, protected] |
Definition at line 15 of file NewParserTest.php.
Referenced by setupGlobals().
NewParserTest::$file = false [protected] |
Definition at line 32 of file NewParserTest.php.
Referenced by deleteFiles().
NewParserTest::$functionHooks = array() |
Definition at line 25 of file NewParserTest.php.
NewParserTest::$fuzzSeed = 0 |
Definition at line 29 of file NewParserTest.php.
NewParserTest::$hooks = array() |
Definition at line 24 of file NewParserTest.php.
NewParserTest::$keepUploads = false |
Definition at line 17 of file NewParserTest.php.
NewParserTest::$maxFuzzTestLength = 300 |
Definition at line 28 of file NewParserTest.php.
NewParserTest::$memoryLimit = 50 |
Definition at line 30 of file NewParserTest.php.
NewParserTest::$regex = '' |
Reimplemented from MediaWikiTestCase.
Definition at line 19 of file NewParserTest.php.
Referenced by parseOptions().
NewParserTest::$runDisabled = false |
Reimplemented from MediaWikiTestCase.
Definition at line 18 of file NewParserTest.php.
NewParserTest::$savedGlobals = array() |
Definition at line 23 of file NewParserTest.php.
NewParserTest::$savedInitialGlobals = array() |
Definition at line 21 of file NewParserTest.php.
NewParserTest::$savedWeirdGlobals = array() |
Definition at line 22 of file NewParserTest.php.
NewParserTest::$showProgress = true |
Definition at line 20 of file NewParserTest.php.