MediaWiki  REL1_23
NewParserTest Class Reference

Although marked as a stub, can work independently. More...

Inheritance diagram for NewParserTest:
Collaboration diagram for NewParserTest:

List of all members.

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 ()
 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.

Detailed Description

Although marked as a stub, can work independently.

Database Parser Stub

Todo:
covers tags

Definition at line 12 of file NewParserTest.php.


Member Function Documentation

NewParserTest::addArticle ( name,
text,
line 
)

Definition at line 838 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

Since:
1.18

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 961 of file NewParserTest.php.

Referenced by parseOptions().

static NewParserTest::deleteFiles ( files) [static, private]

Delete the specified files, if they exist.

Parameters:
$filesArray: full paths to files to delete.

Definition at line 548 of file NewParserTest.php.

References $file, $files, array(), as, FileBackend\parentStoragePath(), and RepoGroup\singleton().

Referenced by teardownUploads().

NewParserTest::getBaseDir ( ) [protected]

Definition at line 563 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 772 of file NewParserTest.php.

References $matches, and as.

Referenced by testFuzzTests().

Get a memory usage breakdown.

Definition at line 790 of file NewParserTest.php.

References $GLOBALS, $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.

Parameters:
$keyString: name of option val to retrieve
$optsOptions array to look in
$defaultMixed: default value returned if not found

Definition at line 979 of file NewParserTest.php.

References $key.

Referenced by setupGlobals().

NewParserTest::getParser ( preprocessor = null)

Get a Parser object.

Definition at line 825 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)

Returns:
String: the directory

Definition at line 405 of file NewParserTest.php.

References $dir, wfDebug(), and wfTempDir().

Referenced by setupGlobals().

NewParserTest::parseOptions ( instring) [protected]

Definition at line 905 of file NewParserTest.php.

References $key, $matches, $regex, array(), as, and cleanupOption().

Referenced by testParserTest().

Definition at line 567 of file NewParserTest.php.

References file, and global.

Definition at line 842 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 895 of file NewParserTest.php.

References $s.

Definition at line 867 of file NewParserTest.php.

References $name, $wgParser, and global.

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.

Parameters:
$nameString
Returns:
Bool true if tag hook is present

Definition at line 861 of file NewParserTest.php.

References $name, $wgParser, and global.

Set the file from whose tests will be run by this instance.

Definition at line 579 of file NewParserTest.php.

References file.

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, $GLOBALS, $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.

Returns:
String: the directory

Definition at line 432 of file NewParserTest.php.

References $IP, array(), getBaseDir(), global, and RepoGroup\singleton().

Referenced by setupGlobals().

static NewParserTest::tearDownAfterClass ( ) [static]

Definition at line 175 of file NewParserTest.php.

References ParserTest\tearDownInterwikis().

Restore default values and perform any necessary clean-up after each test runs.

Definition at line 465 of file NewParserTest.php.

References $GLOBALS, as, and teardownUploads().

Referenced by testFuzzTests(), and testParserTest().

Remove the dummy uploads directory.

Definition at line 476 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.

Todo:
fixme Needs some work to not eat memory until the world explodes

ParserFuzz

Definition at line 695 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::tidy ( text) [protected]

Run the "tidy" command on text if the $wgUseTidy global is true.

Parameters:
$textString: the text to tidy
Returns:
String

Definition at line 882 of file NewParserTest.php.

References global.

Referenced by testParserTest().


Member Data Documentation

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().

NewParserTest::$file = false [protected]

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.

NewParserTest::$hooks = array()

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 = ''

Definition at line 22 of file NewParserTest.php.

Referenced by parseOptions().

NewParserTest::$runDisabled = false

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.


The documentation for this class was generated from the following file: