|
MediaWiki
master
|
Although marked as a stub, can work independently. More...


Public Member Functions | |
| addArticle ($name, $text, $line) | |
| addDBDataOnce () | |
| getFuzzInput ($filenames) | |
| Get an input dictionary from a set of parser test files. More... | |
| getMemoryBreakdown () | |
| Get a memory usage breakdown. More... | |
| getParser ($preprocessor=null) | |
| Get a Parser object. More... | |
| parserTestProvider () | |
| publishTestArticles () | |
| removeEndingNewline ($s) | |
| Remove last character if it is a newline. More... | |
| requireFunctionHook ($name) | |
| requireHook ($name) | |
| Steal a callback function from the primary parser, save it for application to our scary parser. More... | |
| requireTransparentHook ($name) | |
| setParserTestFile ($filename) | |
| Set the file from whose tests will be run by this instance. More... | |
| testFuzzTests () | |
| Run a fuzz test series Draw input from a set of test files. More... | |
| testParserTest ($desc, $input, $result, $opts, $config) | |
| medium ParserTests parserTestProvider More... | |
Public Member Functions inherited from MediaWikiTestCase | |
| __call ($func, $args) | |
| __construct ($name=null, array $data=[], $dataName= '') | |
| __destruct () | |
| addDBData () | |
| Stub. More... | |
| addDBDataOnce () | |
| Stub. More... | |
| dbPrefix () | |
| getCliArg ($offset) | |
| hideDeprecated ($function) | |
| Don't throw a warning if $function is deprecated and called later. More... | |
| needsDB () | |
| run (PHPUnit_Framework_TestResult $result=null) | |
| setCliArg ($offset, $value) | |
| setContentLang ($lang) | |
| setupAllTestDBs () | |
| Set up all test DBs. More... | |
| setUserLang ($lang) | |
| testMediaWikiTestCaseParentSetupCalled () | |
| Make sure MediaWikiTestCase extending classes have called their parent setUp method. More... | |
| 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. More... | |
| static | getMutableTestUser ($groups=[]) |
| Convenience method for getting a mutable test user. More... | |
| static | getTestSysop () |
| Convenience method for getting an immutable admin test user. More... | |
| static | getTestUser ($groups=[]) |
| Convenience method for getting an immutable test user. More... | |
| static | listTables ($db) |
| static | prepareServices (Config $bootstrapConfig) |
| Prepare service configuration for unit testing. More... | |
| static | setUpBeforeClass () |
| static | setupTestDB (DatabaseBase $db, $prefix) |
| Creates an empty skeleton of the wiki database by cloning its structure to equivalent tables using the given $prefix. More... | |
| static | teardownTestDB () |
| Restores MediaWiki to using the table set (table prefix) it was using before setupTestDB() was called. More... | |
| static | wfResetOutputBuffersBarrier ($buffer) |
| Used as a marker to prevent wfResetOutputBuffers from breaking PHPUnit. More... | |
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. More... | |
| const | ORA_DB_PREFIX = 'ut_' |
Protected Member Functions | |
| cleanupOption ($opt) | |
| getBaseDir () | |
| getUploadDir () | |
| Get an FS upload directory (only applies to FSFileBackend) More... | |
| parseOptions ($instring) | |
| setUp () | |
| setupGlobals ($opts=[], $config= '') | |
| Set up the global variables for a consistent environment for each test. More... | |
| setupUploads () | |
| Create a dummy uploads directory which will contain a couple of files in order to pass existence tests. More... | |
| tearDown () | |
| teardownGlobals () | |
| Restore default values and perform any necessary clean-up after each test runs. More... | |
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. More... | |
| assertArrayEquals (array $expected, array $actual, $ordered=false, $named=false) | |
| Assert that two arrays are equal. More... | |
| assertHTMLEquals ($expected, $actual, $msg= '') | |
| Put each HTML element on its own line and then equals() the results. More... | |
| assertSelect ($table, $fields, $condition, array $expectedRows) | |
| Asserts that the given database query yields the rows given by $expectedRows. More... | |
| assertType ($type, $actual, $message= '') | |
| Asserts the type of the provided value. More... | |
| assertTypeOrValue ($type, $actual, $value=false, $message= '') | |
| Asserts that the provided variable is of the specified internal type or equals the $value argument. More... | |
| assertValidHtmlDocument ($html) | |
| Asserts that the given string is valid HTML document. More... | |
| assertValidHtmlSnippet ($html) | |
| Asserts that the given string is a valid HTML snippet. More... | |
| checkDbIsSupported () | |
| checkPHPExtension ($extName) | |
| Check if $extName is a loaded PHP extension, will skip the test whenever it is not loaded. More... | |
| getDefaultWikitextNS () | |
| Returns the ID of a namespace that defaults to Wikitext. More... | |
| getNewTempDirectory () | |
| obtains a new temporary directory More... | |
| getNewTempFile () | |
| Obtains a new temporary file name. More... | |
| insertPage ($pageName, $text= 'Sample page for unit test.') | |
| Insert a new page. More... | |
| isWikitextNS ($ns) | |
| Returns true if the given namespace defaults to Wikitext according to $wgNamespaceContentModels. More... | |
| markTestSkippedIfNoDiff3 () | |
| Check, if $wgDiff3 is set and ready to merge Will mark the calling test as skipped, if not ready. More... | |
| mergeMwGlobalArrayValue ($name, $values) | |
| Merges the given values into a MW global array variable. More... | |
| objectAssociativeSort (array &$array) | |
| Does an associative sort that works for objects. More... | |
| overrideMwServices (Config $configOverrides=null, array $services=[]) | |
| Stashes the global instance of MediaWikiServices, and installs a new one, allowing test cases to override settings and services. More... | |
| setLogger ($channel, LoggerInterface $logger) | |
| Sets the logger for a specified channel, for the duration of the test. More... | |
| setMwGlobals ($pairs, $value=null) | |
| setService ($name, $object) | |
| Sets a service, maintaining a stashed version of the previous service to be restored in tearDown. More... | |
| setUp () | |
| stashMwGlobals ($globalKeys) | |
| Stashes the global, will be restored in tearDown() More... | |
| tearDown () | |
Static Protected Member Functions | |
| static | getOptionValue ($key, $opts, $default) |
| Use a regex to find out the value of an option. More... | |
Static Protected Member Functions inherited from MediaWikiTestCase | |
| static | getExternalStoreDatabaseConnections () |
| Gets master database connections for all of the ExternalStoreDB stores configured in $wgDefaultExternalStore. More... | |
| static | isUsingExternalStoreDB () |
| Check whether ExternalStoreDB is being used. More... | |
| static | resetGlobalServices (Config $bootstrapConfig=null) |
| Reset global services, and install testing environment. More... | |
| static | setupDatabaseWithTestPrefix (DatabaseBase $db, $prefix) |
| Setups a database with the given prefix. More... | |
| static | setupExternalStoreTestDBs ($testPrefix) |
| Clones the External Store database(s) for testing. More... | |
| static | stripStringKeys (&$r) |
| Utility function for eliminating all string keys from an array. More... | |
Protected Attributes | |
| $file = false | |
Protected Attributes inherited from MediaWikiTestCase | |
| DatabaseBase | $db |
| Primary database. More... | |
| array | $supportedDBs |
| array | $tablesUsed = [] |
Static Protected Attributes | |
| static | $articles = [] |
| static | $backendToUse |
Private Member Functions | |
| teardownUploads () | |
| Remove the dummy uploads directory. More... | |
Static Private Member Functions | |
| static | deleteFiles ($files) |
| Delete the specified files, if they exist. More... | |
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 11 of file NewParserTest.php.
| NewParserTest::addArticle | ( | $name, | |
| $text, | |||
| $line | |||
| ) |
Definition at line 995 of file NewParserTest.php.
| NewParserTest::addDBDataOnce | ( | ) |
Definition at line 211 of file NewParserTest.php.
References $image, $user, at, Title\makeTitle(), MEDIATYPE_AUDIO, MEDIATYPE_BITMAP, MEDIATYPE_DRAWING, MEDIATYPE_VIDEO, User\newFromId(), NS_FILE, serialize(), LinkCache\singleton(), the, and wfLocalFile().
|
protected |
Definition at line 1109 of file NewParserTest.php.
Referenced by parseOptions().
|
staticprivate |
Delete the specified files, if they exist.
| array | $files | Full paths to files to delete. |
Definition at line 669 of file NewParserTest.php.
References $file, $files, as, FileBackend\parentStoragePath(), and RepoGroup\singleton().
|
protected |
Definition at line 685 of file NewParserTest.php.
Referenced by setupUploads(), and teardownUploads().
| NewParserTest::getFuzzInput | ( | $filenames | ) |
Get an input dictionary from a set of parser test files.
| array | $filenames |
Definition at line 926 of file NewParserTest.php.
Referenced by testFuzzTests().
| NewParserTest::getMemoryBreakdown | ( | ) |
Get a memory usage breakdown.
Definition at line 945 of file NewParserTest.php.
References $GLOBALS, $name, $value, as, and serialize().
Referenced by testFuzzTests().
|
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 1128 of file NewParserTest.php.
| NewParserTest::getParser | ( | $preprocessor = null | ) |
Get a Parser object.
| Preprocessor | $preprocessor |
Definition at line 982 of file NewParserTest.php.
References $parser, global, and Hooks\run().
Referenced by testFuzzTests(), and testParserTest().
|
protected |
Get an FS upload directory (only applies to FSFileBackend)
Definition at line 513 of file NewParserTest.php.
References $dir, MediaWikiTestCase\getNewTempDirectory(), wfDebug(), and wfTempDir().
Referenced by setupGlobals().
|
protected |
Definition at line 1053 of file NewParserTest.php.
References $matches, $regex, as, and cleanupOption().
Referenced by testParserTest().
| NewParserTest::parserTestProvider | ( | ) |
Definition at line 689 of file NewParserTest.php.
References $wgParserTestFiles, file, and global.
| NewParserTest::publishTestArticles | ( | ) |
Definition at line 999 of file NewParserTest.php.
References $line, $name, ParserTest\addArticle(), as, and list.
Referenced by setupGlobals().
| NewParserTest::removeEndingNewline | ( | $s | ) |
Remove last character if it is a newline.
| string | $s |
Definition at line 1043 of file NewParserTest.php.
References $s.
| NewParserTest::requireFunctionHook | ( | $name | ) |
Definition at line 1024 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 1018 of file NewParserTest.php.
| NewParserTest::requireTransparentHook | ( | $name | ) |
Definition at line 1030 of file NewParserTest.php.
| NewParserTest::setParserTestFile | ( | $filename | ) |
Set the file from whose tests will be run by this instance.
| string | $filename |
Definition at line 702 of file NewParserTest.php.
References file.
|
protected |
Definition at line 50 of file NewParserTest.php.
References $GLOBALS, $handler, $IP, $type, $wgContLang, $wgHooks, $wgMediaHandlers, $wgNamespaceAliases, as, cache, CACHE_NONE, Language\factory(), MWNamespace\getCanonicalNamespaces(), MediaWikiTestCase\getCliArg(), global, NS_FILE, NS_FILE_TALK, NS_MEDIAWIKI, and MediaWikiTestCase\setMwGlobals().
|
static |
Definition at line 45 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 389 of file NewParserTest.php.
References $context, $GLOBALS, $lang, $line, $name, $value, $wgFileBackends, as, MagicWord\clearCache(), MessageCache\destroyInstance(), FileBackendGroup\destroySingleton(), RepoGroup\destroySingleton(), MWTidy\destroySingleton(), Language\factory(), MediaWikiTestCase\getCliArg(), getUploadDir(), global, list, NS_MAIN, publishTestArticles(), Hooks\run(), setupUploads(), and wfWikiID().
Referenced by testFuzzTests(), and testParserTest().
|
protected |
Create a dummy uploads directory which will contain a couple of files in order to pass existence tests.
Definition at line 540 of file NewParserTest.php.
References $base, $IP, getBaseDir(), global, and RepoGroup\singleton().
Referenced by setupGlobals().
|
protected |
Definition at line 182 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 206 of file NewParserTest.php.
References ParserTest\tearDownInterwikis().
|
protected |
Restore default values and perform any necessary clean-up after each test runs.
Definition at line 581 of file NewParserTest.php.
References $GLOBALS, as, and teardownUploads().
Referenced by testFuzzTests(), and testParserTest().
|
private |
Remove the dummy uploads directory.
Definition at line 592 of file NewParserTest.php.
References $base, getBaseDir(), and RepoGroup\singleton().
Referenced by teardownGlobals().
| NewParserTest::testFuzzTests | ( | ) |
Run a fuzz test series Draw input from a set of test files.
ParserFuzz
Definition at line 847 of file NewParserTest.php.
References $files, $name, $parser, $ret, $title, $user, $wgParserTestFiles, as, MediaWikiTestCase\getCliArg(), getFuzzInput(), getMemoryBreakdown(), getParser(), global, Title\makeTitle(), ParserOptions\newFromUser(), NS_MAIN, setupGlobals(), teardownGlobals(), and User.
| NewParserTest::testParserTest | ( | $desc, | |
| $input, | |||
| $result, | |||
| $opts, | |||
| $config | |||
| ) |
medium ParserTests parserTestProvider
| string | $desc | |
| string | $input | |
| string | $result | |
| array | $opts | |
| array | $config |
Definition at line 716 of file NewParserTest.php.
References $content, $context, $options, $out, $output, $parser, $section, $title, $user, as, Linker\formatComment(), ParserOutput\getCategories(), ParserOutput\getIndicators(), ParserOutput\getLanguageLinks(), getParser(), ParserOutput\getText(), ParserOutput\getTitleText(), global, MediaWikiTestCase\isWikitextNS(), ParserOptions\newFromContext(), Title\newFromText(), NS_MAIN, parseOptions(), ParserOutput\setTOCEnabled(), setupGlobals(), teardownGlobals(), and wfDebug().
|
staticprotected |
Definition at line 12 of file NewParserTest.php.
|
staticprotected |
Definition at line 16 of file NewParserTest.php.
|
private |
Definition at line 37 of file NewParserTest.php.
|
protected |
Definition at line 43 of file NewParserTest.php.
Referenced by deleteFiles().
| NewParserTest::$functionHooks = [] |
Definition at line 26 of file NewParserTest.php.
| NewParserTest::$fuzzSeed = 0 |
Definition at line 31 of file NewParserTest.php.
| NewParserTest::$hooks = [] |
Definition at line 25 of file NewParserTest.php.
| NewParserTest::$keepUploads = false |
Definition at line 18 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 21 of file NewParserTest.php.
Referenced by parseOptions().
| NewParserTest::$runDisabled = false |
Definition at line 19 of file NewParserTest.php.
| NewParserTest::$runParsoid = false |
Definition at line 20 of file NewParserTest.php.
| NewParserTest::$savedGlobals = [] |
Definition at line 24 of file NewParserTest.php.
| NewParserTest::$savedWeirdGlobals = [] |
Definition at line 23 of file NewParserTest.php.
| NewParserTest::$showProgress = true |
Definition at line 22 of file NewParserTest.php.
|
private |
Definition at line 41 of file NewParserTest.php.
| NewParserTest::$transparentHooks = [] |
Definition at line 27 of file NewParserTest.php.