MediaWiki REL1_27
|
Although marked as a stub, can work independently. More...
Public Member Functions | |
addArticle ( $name, $text, $line) | |
addDBDataOnce () | |
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. | |
requireTransparentHook ( $name) | |
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 ParserTests parserTestProvider | |
Public Member Functions inherited from MediaWikiTestCase | |
__call ( $func, $args) | |
__construct ( $name=null, array $data=[], $dataName='') | |
__destruct () | |
addDBData () | |
Stub. | |
dbPrefix () | |
getCliArg ( $offset) | |
hideDeprecated ( $function) | |
Don't throw a warning if $function is deprecated and called later. | |
needsDB () | |
run (PHPUnit_Framework_TestResult $result=null) | |
setCliArg ( $offset, $value) | |
setContentLang ( $lang) | |
setupAllTestDBs () | |
Set up all test DBs. | |
setUserLang ( $lang) | |
testMediaWikiTestCaseParentSetupCalled () | |
Make sure MediaWikiTestCase extending classes have called their parent setUp method. | |
usesTemporaryTables () | |
Static Public Member Functions | |
static | setUpBeforeClass () |
static | tearDownAfterClass () |
Static Public Member Functions inherited from MediaWikiTestCase | |
static | assertNotTag ( $matcher, $actual, $message='', $isHtml=true) |
static | assertTag ( $matcher, $actual, $message='', $isHtml=true) |
Note: we are overriding this method to remove the deprecated error. | |
static | listTables ( $db) |
static | setupTestDB (DatabaseBase $db, $prefix) |
Creates an empty skeleton of the wiki database by cloning its structure to equivalent tables using the given $prefix. | |
static | teardownTestDB () |
Restores MediaWiki to using the table set (table prefix) it was using before setupTestDB() was called. | |
static | wfResetOutputBuffersBarrier ( $buffer) |
Used as a marker to prevent wfResetOutputBuffers from breaking PHPUnit. | |
Public Attributes | |
$functionHooks = [] | |
$fuzzSeed = 0 | |
$hooks = [] | |
$keepUploads = false | |
$maxFuzzTestLength = 300 | |
$memoryLimit = 50 | |
$regex = '' | |
$runDisabled = false | |
$runParsoid = false | |
$savedGlobals = [] | |
$savedWeirdGlobals = [] | |
$showProgress = true | |
$transparentHooks = [] | |
Public Attributes inherited from MediaWikiTestCase | |
const | DB_PREFIX = 'unittest_' |
Table name prefixes. | |
const | ORA_DB_PREFIX = 'ut_' |
Protected Member Functions | |
cleanupOption ( $opt) | |
getBaseDir () | |
getUploadDir () | |
Get an FS upload directory (only applies to FSFileBackend) | |
parseOptions ( $instring) | |
setUp () | |
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. | |
tearDown () | |
teardownGlobals () | |
Restore default values and perform any necessary clean-up after each test runs. | |
Protected Member Functions inherited from MediaWikiTestCase | |
addTmpFiles ( $files) | |
arrayWrap (array $elements) | |
Utility method taking an array of elements and wrapping each element in its own array. | |
assertArrayEquals (array $expected, array $actual, $ordered=false, $named=false) | |
Assert that two arrays are equal. | |
assertHTMLEquals ( $expected, $actual, $msg='') | |
Put each HTML element on its own line and then equals() the results. | |
assertSelect ( $table, $fields, $condition, array $expectedRows) | |
Asserts that the given database query yields the rows given by $expectedRows. | |
assertType ( $type, $actual, $message='') | |
Asserts the type of the provided value. | |
assertTypeOrValue ( $type, $actual, $value=false, $message='') | |
Asserts that the provided variable is of the specified internal type or equals the $value argument. | |
assertValidHtmlDocument ( $html) | |
Asserts that the given string is valid HTML document. | |
assertValidHtmlSnippet ( $html) | |
Asserts that the given string is a valid HTML snippet. | |
checkDbIsSupported () | |
checkHasGzip () | |
Check whether we have the 'gzip' commandline utility, will skip the test whenever "gzip -V" fails. | |
checkPHPExtension ( $extName) | |
Check if $extName is a loaded PHP extension, will skip the test whenever it is not loaded. | |
getDefaultWikitextNS () | |
Returns the ID of a namespace that defaults to Wikitext. | |
getNewTempDirectory () | |
obtains a new temporary directory | |
getNewTempFile () | |
Obtains a new temporary file name. | |
insertPage ( $pageName, $text='Sample page for unit test.') | |
Insert a new page. | |
isWikitextNS ( $ns) | |
Returns true if the given namespace defaults to Wikitext according to $wgNamespaceContentModels. | |
markTestSkippedIfNoDiff3 () | |
Check, if $wgDiff3 is set and ready to merge Will mark the calling test as skipped, if not ready. | |
mergeMwGlobalArrayValue ( $name, $values) | |
Merges the given values into a MW global array variable. | |
objectAssociativeSort (array &$array) | |
Does an associative sort that works for objects. | |
setLogger ( $channel, LoggerInterface $logger) | |
Sets the logger for a specified channel, for the duration of the test. | |
setMwGlobals ( $pairs, $value=null) | |
stashMwGlobals ( $globalKeys) | |
Stashes the global, will be restored in tearDown() | |
Static Protected Member Functions | |
static | getOptionValue ( $key, $opts, $default) |
Use a regex to find out the value of an option. | |
Static Protected Member Functions inherited from MediaWikiTestCase | |
static | getExternalStoreDatabaseConnections () |
Gets master database connections for all of the ExternalStoreDB stores configured in $wgDefaultExternalStore. | |
static | isUsingExternalStoreDB () |
Check whether ExternalStoreDB is being used. | |
static | setupDatabaseWithTestPrefix (DatabaseBase $db, $prefix) |
Setups a database with the given prefix. | |
static | setupExternalStoreTestDBs ( $testPrefix) |
Clones the External Store database(s) for testing. | |
static | stripStringKeys (&$r) |
Utility function for eliminating all string keys from an array. | |
Protected Attributes | |
$file = false | |
Protected Attributes inherited from MediaWikiTestCase | |
DatabaseBase | $db |
Primary database. | |
array | $supportedDBs |
array | $tablesUsed = [] |
Static Protected Attributes | |
static | $articles = [] |
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. | |
Private Attributes | |
DjVuSupport | $djVuSupport |
TidySupport | $tidySupport |
Additional Inherited Members | |
Static Public Attributes inherited from MediaWikiTestCase | |
static TestUser[] | $users |
Although marked as a stub, can work independently.
Definition at line 12 of file NewParserTest.php.
NewParserTest::addArticle | ( | $name, | |
$text, | |||
$line | |||
) |
Definition at line 981 of file NewParserTest.php.
NewParserTest::addDBDataOnce | ( | ) |
Stub.
If a test suite needs to add additional data to the database, it should implement this method and do so. This method is called once per test suite (i.e. once per class).
Note data added by this method may be removed by resetDB() depending on the contents of $tablesUsed.
To add additional data between test function runs, override prepareDB().
Reimplemented from MediaWikiTestCase.
Definition at line 212 of file NewParserTest.php.
References $image, $user, Title\makeTitle(), MEDIATYPE_BITMAP, MEDIATYPE_DRAWING, MEDIATYPE_VIDEO, NS_FILE, serialize(), LinkCache\singleton(), the, and wfLocalFile().
|
protected |
Definition at line 1095 of file NewParserTest.php.
|
staticprivate |
Delete the specified files, if they exist.
array | $files | Full paths to files to delete. |
Definition at line 655 of file NewParserTest.php.
References $files, as, FileBackend\parentStoragePath(), and RepoGroup\singleton().
|
protected |
Definition at line 671 of file NewParserTest.php.
NewParserTest::getFuzzInput | ( | $filenames | ) |
Get an input dictionary from a set of parser test files.
array | $filenames |
Definition at line 912 of file NewParserTest.php.
NewParserTest::getMemoryBreakdown | ( | ) |
Get a memory usage breakdown.
Definition at line 931 of file NewParserTest.php.
References $GLOBALS, $name, $value, as, and serialize().
|
staticprotected |
Use a regex to find out the value of an option.
string | $key | Name of option val to retrieve |
array | $opts | Options array to look in |
mixed | $default | Default value returned if not found |
Definition at line 1114 of file NewParserTest.php.
NewParserTest::getParser | ( | $preprocessor = null | ) |
Get a Parser object.
Preprocessor | $preprocessor |
Definition at line 968 of file NewParserTest.php.
References $parser, $wgParserConf, and global.
|
protected |
Get an FS upload directory (only applies to FSFileBackend)
Definition at line 499 of file NewParserTest.php.
References $dir, wfDebug(), and wfTempDir().
|
protected |
Definition at line 1039 of file NewParserTest.php.
NewParserTest::parserTestProvider | ( | ) |
Definition at line 675 of file NewParserTest.php.
References $wgParserTestFiles, file, and global.
NewParserTest::publishTestArticles | ( | ) |
Definition at line 985 of file NewParserTest.php.
References $line, $name, ParserTest\addArticle(), as, and list.
NewParserTest::removeEndingNewline | ( | $s | ) |
Remove last character if it is a newline.
string | $s |
Definition at line 1029 of file NewParserTest.php.
References $s.
NewParserTest::requireFunctionHook | ( | $name | ) |
Definition at line 1010 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.
string | $name |
Definition at line 1004 of file NewParserTest.php.
NewParserTest::requireTransparentHook | ( | $name | ) |
Definition at line 1016 of file NewParserTest.php.
NewParserTest::setParserTestFile | ( | $filename | ) |
Set the file from whose tests will be run by this instance.
string | $filename |
Definition at line 688 of file NewParserTest.php.
References file.
|
protected |
Reimplemented from MediaWikiTestCase.
Definition at line 51 of file NewParserTest.php.
References $GLOBALS, $handler, $IP, $type, $wgContLang, $wgHooks, $wgMediaHandlers, $wgNamespaceAliases, as, cache, CACHE_NONE, MWNamespace\getCanonicalNamespaces(), MediaWikiTestCase\getCliArg(), global, NS_FILE, NS_FILE_TALK, NS_MEDIAWIKI, and MediaWikiTestCase\setMwGlobals().
|
static |
Definition at line 46 of file NewParserTest.php.
References ParserTest\setupInterwikis().
|
protected |
Set up the global variables for a consistent environment for each test.
Ideally this should replace the global configuration entirely.
array | $opts | |
string | $config |
Definition at line 376 of file NewParserTest.php.
References $context, $GLOBALS, $lang, $line, $name, $value, $wgFileBackends, as, MagicWord\clearCache(), MessageCache\destroyInstance(), FileBackendGroup\destroySingleton(), RepoGroup\destroySingleton(), MWTidy\destroySingleton(), global, list, NS_MAIN, and wfWikiID().
|
protected |
Create a dummy uploads directory which will contain a couple of files in order to pass existence tests.
Definition at line 526 of file NewParserTest.php.
References $base, $IP, global, and RepoGroup\singleton().
|
protected |
Reimplemented from MediaWikiTestCase.
Definition at line 183 of file NewParserTest.php.
References $wgContLang, $wgNamespaceAliases, cache, MessageCache\destroyInstance(), FileBackendGroup\destroySingleton(), RepoGroup\destroySingleton(), MWTidy\destroySingleton(), MWNamespace\getCanonicalNamespaces(), global, and LinkCache\singleton().
|
static |
Definition at line 207 of file NewParserTest.php.
References ParserTest\tearDownInterwikis().
|
protected |
Restore default values and perform any necessary clean-up after each test runs.
Definition at line 567 of file NewParserTest.php.
|
private |
Remove the dummy uploads directory.
Definition at line 578 of file NewParserTest.php.
References $base, and RepoGroup\singleton().
NewParserTest::testFuzzTests | ( | ) |
Run a fuzz test series Draw input from a set of test files.
ParserFuzz
Definition at line 833 of file NewParserTest.php.
References $files, $name, $parser, $ret, $title, $user, $wgParserTestFiles, as, global, Title\makeTitle(), ParserOptions\newFromUser(), and NS_MAIN.
NewParserTest::testParserTest | ( | $desc, | |
$input, | |||
$result, | |||
$opts, | |||
$config | |||
) |
medium ParserTests parserTestProvider
string | $desc | |
string | $input | |
string | $result | |
array | $opts | |
array | $config |
Definition at line 702 of file NewParserTest.php.
References $content, $context, $options, $out, $output, $parser, $section, $title, $user, as, Linker\formatComment(), ParserOutput\getCategories(), ParserOutput\getIndicators(), ParserOutput\getLanguageLinks(), ParserOutput\getText(), ParserOutput\getTitleText(), global, ParserOptions\newFromContext(), Title\newFromText(), NS_MAIN, ParserOutput\setTOCEnabled(), and wfDebug().
|
staticprotected |
Definition at line 13 of file NewParserTest.php.
|
staticprotected |
Definition at line 17 of file NewParserTest.php.
|
private |
Definition at line 38 of file NewParserTest.php.
|
protected |
Definition at line 44 of file NewParserTest.php.
NewParserTest::$functionHooks = [] |
Definition at line 27 of file NewParserTest.php.
NewParserTest::$fuzzSeed = 0 |
Definition at line 32 of file NewParserTest.php.
NewParserTest::$hooks = [] |
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 31 of file NewParserTest.php.
NewParserTest::$memoryLimit = 50 |
Definition at line 33 of file NewParserTest.php.
NewParserTest::$regex = '' |
Definition at line 22 of file NewParserTest.php.
NewParserTest::$runDisabled = false |
Definition at line 20 of file NewParserTest.php.
NewParserTest::$runParsoid = false |
Definition at line 21 of file NewParserTest.php.
NewParserTest::$savedGlobals = [] |
Definition at line 25 of file NewParserTest.php.
NewParserTest::$savedWeirdGlobals = [] |
Definition at line 24 of file NewParserTest.php.
NewParserTest::$showProgress = true |
Definition at line 23 of file NewParserTest.php.
|
private |
Definition at line 42 of file NewParserTest.php.
NewParserTest::$transparentHooks = [] |
Definition at line 28 of file NewParserTest.php.