MediaWiki
REL1_24
|
Inherited by ActionTest, ApiModuleManagerTest, ArrayDiffFormatterTest, ArrayUtilsTest, ArticleTest, AutoLoaderTest, BadTitleErrorTest, BagOStuffTest, BaseDumpTest, BitmapMetadataHandlerTest, BitmapScalingTest, BloomCacheRedisTest, CdbTest, CLDRPluralRuleEvaluatorTest, CleanUpTest, ConfigFactoryTest, ContentHandlerTest, CSSMinTest, DatabaseMysqlBaseTest, DatabaseSqliteTest, DatabaseSQLTest, DatabaseTest, DeferredUpdatesTest, DifferenceEngineTest, DiffHistoryBlobTest, DiffOpTest, DiffTest, DummyExtensionsTest, ErrorPageErrorTest, ExifBitmapTest, ExifTest, ExternalStoreTest, ExtraParserTest, FallbackTest, FauxRequestTest, FauxResponseTest, FetchTextTest, FileBackendTest, FileRepoTest, FormatJsonTest, FormOptionsInitializationTest, FormOptionsTest, GenericArrayObjectTest, GIFMetadataExtractorTest, GitInfoTest, GlobalTest, GlobalVarConfigTest, GlobalWithDBTest, HashConfigTest, HashRingTest, HooksTest, HtmlAutoCompleteSelectFieldTest, HtmlCheckMatrixTest, HtmlFormatterTest, HtmlTest, HttpTest, IEUrlExtensionTest, ImageListPagerTest, InstallDocFormatterTest, IPSetTest, IPTCTest, IPTest, JavaScriptMinifierTest, JobQueueTest, JpegMetadataExtractorTest, LanguageClassesTestCase, LBFactoryTest, LicensesTest, LinksUpdateTest, LocalFileTest, LocalisationCacheTest, MagicVariableTest, MailAddressTest, MaintenanceTest, MediaHandlerTest, MediaWikiLangTestCase, MediaWikiMediaTestCase, MediaWikiPageLinkRendererTest, MediaWikiTestCaseTest, MediaWikiTitleCodecTest, MimeMagicTest, MultiConfigTest, MWCryptHKDFTest, MWDebugTest, MWExceptionHandlerTest, MWExceptionTest, MWFunctionTest, MWMessagePackTest, MWNamespaceTest, NewParserTest, OracleInstallerTest, ORMRowTest, ORMTableTest, OutputPageTest, ParserOutputTest, ParserPreloadTest, PasswordTest, PasswordTestCase, PathRouterTest, PNGMetadataExtractorTest, PoolCounterTest, PreferencesTest, PrefixUniquenessTest, PreprocessorTest, ProcessCacheLRUTest, QueryAllSpecialPagesTest, ReadOnlyErrorTest, RecentChangeTest, RefreshLinksPartitionTest, RepoGroupTest, RequestContextTest, ResourceLoaderTestCase, ResourcesTest, RevisionStorageTest, RevisionTest, RunningStatTest, SanitizerTest, SanitizerValidateEmailTest, SearchUpdateTest, SiteConfigurationTest, SiteListTest, SiteSQLStoreTest, SiteTest, SkinFactoryTest, SkinTemplateTest, SpecialMIMESearchTest, SpecialMyLanguageTest, SpecialPageAliasTest, SpecialPageFactoryTest, SpecialPageTest, SpecialPreferencesTest, SpecialRecentchangesTest, SpecialSearchTest, StoreBatchTest, StringUtilsTest, StructureTest, SVGMetadataExtractorTest, TagHookTest, ThrottledErrorTest, TidyTest, TiffTest, TitleArrayFromResultTest, TitleMethodsTest, TitleTest, TitleValueTest, UIDGeneratorTest, UploadBaseTest, UploadStashTest, UserArrayFromResultTest, UserNotLoggedInTest, UserTest, WebRequestTest, WfAssembleUrlTest, WfBaseConvertTest, WfBaseNameTest, WfBCP47Test, WfExpandUrlTest, WfGetCallerTest, WfParseUrlTest, WfRemoveDotSegmentsTest, WfShellExecTest, WfShorthandToIntegerTest, WfTimestampTest, WfUrlencodeTest, XmlJs, XmlSelectTest, XmlTest, XmlTypeCheckTest, XMPTest, XMPValidateTest, and ZipDirectoryReaderTest.
Public Member Functions | |
__call ($func, $args) | |
__construct ($name=null, array $data=array(), $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) | |
testMediaWikiTestCaseParentSetupCalled () | |
Make sure MediaWikiTestCase extending classes have called their parent setUp method. | |
usesTemporaryTables () | |
Static Public Member Functions | |
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. | |
Public Attributes | |
const | DB_PREFIX = 'unittest_' |
Table name prefixes. | |
const | ORA_DB_PREFIX = 'ut_' |
Static Public Attributes | |
static | $users |
Protected Member Functions | |
arrayWrap (array $elements) | |
Utility method taking an array of elements and wrapping each element in it's own array. | |
assertArrayEquals (array $expected, array $actual, $ordered=false, $named=false) | |
Assert that two arrays are equal. | |
assertException ($code, $expected= 'Exception', $message= '') | |
Asserts that an exception of the specified type occurs when running the provided code. | |
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 () | |
checkHasDiff3 () | |
Check, if $wgDiff3 is set and ready to merge Will mark the calling test as skipped, if not ready. | |
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. | |
isWikitextNS ($ns) | |
Returns true if the given namespace defaults to Wikitext according to $wgNamespaceContentModels. | |
mergeMwGlobalArrayValue ($name, $values) | |
Merges the given values into a MW global array variable. | |
objectAssociativeSort (array &$array) | |
Does an associative sort that works for objects. | |
setMwGlobals ($pairs, $value=null) | |
setUp () | |
stashMwGlobals ($globalKeys) | |
Stashes the global, will be restored in tearDown() | |
tearDown () | |
Static Protected Member Functions | |
static | stripStringKeys (&$r) |
Utility function for eliminating all string keys from an array. | |
Protected Attributes | |
DatabaseBase | $db |
array | $supportedDBs |
array | $tablesUsed = array() |
Private Member Functions | |
addCoreDBData () | |
assertEmpty2 ($value, $msg) | |
Used as a compatibility method for phpunit < 3.7.32. | |
resetDB () | |
Empty all tables so they can be repopulated for tests. | |
Static Private Member Functions | |
static | isNotUnittest ($table) |
static | unprefixTable ($tableName) |
Private Attributes | |
$called = array() | |
$called tracks whether the setUp and tearDown method has been called. | |
array | $mwGlobals = array() |
Holds original values of MediaWiki configuration settings to be restored in tearDown(). | |
int | $phpErrorLevel |
Original value of PHP's error_reporting setting. | |
array | $tmpFiles = array() |
Holds the paths of temporary files/directories created through getNewTempFile, and getNewTempDirectory. | |
Static Private Attributes | |
static | $dbSetup = false |
static | $oldTablePrefix = false |
static | $reuseDB = false |
static | $useTemporaryTables = true |
Definition at line 6 of file MediaWikiTestCase.php.
MediaWikiTestCase::__construct | ( | $ | name = null , |
array $ | data = array() , |
||
$ | dataName = '' |
||
) |
Reimplemented in OldChangesListTest, RevisionStorageTest, EnhancedChangesListTest, RCCacheEntryFactoryTest, WikiPageTest, JobQueueTest, RefreshLinksPartitionTest, and LinksUpdateTest.
Definition at line 78 of file MediaWikiTestCase.php.
Referenced by RevisionTestModifyableContent\__construct(), and RevisionTestModifyableContentHandler\__construct().
Definition at line 85 of file MediaWikiTestCase.php.
MediaWikiTestCase::__call | ( | $ | func, |
$ | args | ||
) |
string | $func | |
array | $args |
MWException |
Reimplemented in MWNamespaceTest.
Definition at line 592 of file MediaWikiTestCase.php.
MediaWikiTestCase::addCoreDBData | ( | ) | [private] |
Definition at line 434 of file MediaWikiTestCase.php.
Stub.
If a test needs to add additional data to the database, it should implement this method and do so
Reimplemented in NewParserTest, FetchTextTest, BackupDumperLoggerTest, ApiQueryBasicTest, ApiQueryContinueTest, ApiQueryContinue2Test, MessageCacheTest, TextPassDumperTest, BlockTest, BackupDumperPageTest, ApiBlockTest, GenderCacheTest, and SpecialMyLanguageTest.
Definition at line 431 of file MediaWikiTestCase.php.
MediaWikiTestCase::arrayWrap | ( | array $ | elements | ) | [protected] |
Utility method taking an array of elements and wrapping each element in it's own array.
Useful for data providers that only return a single argument.
array | $elements |
Definition at line 759 of file MediaWikiTestCase.php.
Referenced by SiteTest\instanceProvider(), GenericArrayObjectTest\instanceProvider(), SiteListTest\siteArrayProvider(), and SiteListTest\siteListProvider().
MediaWikiTestCase::assertArrayEquals | ( | array $ | expected, |
array $ | actual, | ||
$ | ordered = false , |
||
$ | named = false |
||
) | [protected] |
Assert that two arrays are equal.
By default this means that both arrays need to hold the same set of values. Using additional arguments, order and associated key can also be set as relevant.
array | $expected | |
array | $actual | |
bool | $ordered | If the order of the values should match |
bool | $named | If the keys should match |
Definition at line 780 of file MediaWikiTestCase.php.
Referenced by SiteListTest\testGetGlobalIdentifiers(), ApiModuleManagerTest\testGetGroups(), DjVuTest\testGetImageSize(), ApiModuleManagerTest\testGetNames(), ApiModuleManagerTest\testGetNamesWithClasses(), DjVuTest\testGetPageDimensions(), TextContentTest\testGetParserOutput(), PoolCounterTest\testHashKeyIntoSlots(), SiteListTest\testSerialization(), GenericArrayObjectTest\testSerialization(), UIDGeneratorTest\testTimestampedUID(), and LinksUpdateTest\testUpdate_pagelinks().
MediaWikiTestCase::assertEmpty2 | ( | $ | value, |
$ | msg | ||
) | [private] |
Used as a compatibility method for phpunit < 3.7.32.
string | $value | |
string | $msg |
Definition at line 610 of file MediaWikiTestCase.php.
References $value.
MediaWikiTestCase::assertException | ( | $ | code, |
$ | expected = 'Exception' , |
||
$ | message = '' |
||
) | [protected] |
Asserts that an exception of the specified type occurs when running the provided code.
callable | $code | |
string | $expected | |
string | $message |
Definition at line 1045 of file MediaWikiTestCase.php.
MediaWikiTestCase::assertHTMLEquals | ( | $ | expected, |
$ | actual, | ||
$ | msg = '' |
||
) | [protected] |
Put each HTML element on its own line and then equals() the results.
Use for nicely formatting of PHPUnit diff output when comparing very simple HTML
string | $expected | HTML on oneline |
string | $actual | HTML on oneline |
string | $msg | Optional message |
Definition at line 811 of file MediaWikiTestCase.php.
MediaWikiTestCase::assertSelect | ( | $ | table, |
$ | fields, | ||
$ | condition, | ||
array $ | expectedRows | ||
) | [protected] |
Asserts that the given database query yields the rows given by $expectedRows.
The expected rows should be given as indexed (not associative) arrays, with the values given in the order of the columns in the $fields parameter. Note that the rows are sorted by the columns given in $fields.
string | array | $table | The table(s) to query |
string | array | $fields | The columns to include in the result (and to sort by) |
string | array | $condition | "where" condition(s) |
array | $expectedRows | An array of arrays giving the expected rows. |
MWException | If this test cases's needsDB() method doesn't return true. Test cases can use "@group Database" to enable database test support, or list the tables under testing in $this->tablesUsed, or override the needsDB() method. |
Definition at line 719 of file MediaWikiTestCase.php.
Referenced by LinksUpdateTest\assertLinksUpdate().
static MediaWikiTestCase::assertTag | ( | $ | matcher, |
$ | actual, | ||
$ | message = '' , |
||
$ | isHtml = true |
||
) | [static] |
Note: we are overriding this method to remove the deprecated error.
array | $matcher | |
string | $actual | |
string | $message | |
bool | $isHtml |
Definition at line 1126 of file MediaWikiTestCase.php.
Referenced by RCCacheEntryFactoryTest\assertDeleteLogLink(), RCCacheEntryFactoryTest\assertQueryLink(), RCCacheEntryFactoryTest\assertRevDel(), RCCacheEntryFactoryTest\assertTitleLink(), and RCCacheEntryFactoryTest\assertUserLinks().
MediaWikiTestCase::assertType | ( | $ | type, |
$ | actual, | ||
$ | message = '' |
||
) | [protected] |
Asserts the type of the provided value.
This can be either in internal type such as boolean or integer, or a class or interface the value extends or implements.
string | $type | |
mixed | $actual | |
string | $message |
Definition at line 887 of file MediaWikiTestCase.php.
Referenced by ActionTest\testActionFactory(), UIDGeneratorTest\testNewSequentialID(), UIDGeneratorTest\testNewSequentialIDs(), FormatJsonTest\testParse(), FormatJsonTest\testParseErrors(), FormatJsonTest\testParseTryFixing(), and ApiQueryTestBase\validateRequestExpectedPair().
MediaWikiTestCase::assertTypeOrValue | ( | $ | type, |
$ | actual, | ||
$ | value = false , |
||
$ | message = '' |
||
) | [protected] |
Asserts that the provided variable is of the specified internal type or equals the $value argument.
This is useful for testing return types of functions that return a certain type or *value* when not set or on error.
string | $type | |
mixed | $actual | |
mixed | $value | |
string | $message |
Definition at line 868 of file MediaWikiTestCase.php.
Referenced by SiteTest\testGetGlobalId(), SiteTest\testGetLanguageCode(), and SiteTest\testGetPath().
MediaWikiTestCase::assertValidHtmlDocument | ( | $ | html | ) | [protected] |
Asserts that the given string is valid HTML document.
string | $html | A complete HTML document |
Definition at line 1091 of file MediaWikiTestCase.php.
MediaWikiTestCase::assertValidHtmlSnippet | ( | $ | html | ) | [protected] |
Asserts that the given string is a valid HTML snippet.
Wraps the given string in the required top level tags and then calls assertValidHtmlDocument(). The snippet is expected to be HTML 5.
string | $html | An HTML snippet (treated as the contents of the body tag). |
Definition at line 1075 of file MediaWikiTestCase.php.
Referenced by HtmlFormatterTest\testTransform().
MediaWikiTestCase::checkDbIsSupported | ( | ) | [protected] |
MediaWikiTestCase::checkHasDiff3 | ( | ) | [protected] |
Check, if $wgDiff3 is set and ready to merge Will mark the calling test as skipped, if not ready.
Definition at line 977 of file MediaWikiTestCase.php.
Referenced by EditPageTest\testAutoMerge(), and GlobalTest\testMerge().
MediaWikiTestCase::checkHasGzip | ( | ) | [protected] |
Check whether we have the 'gzip' commandline utility, will skip the test whenever "gzip -V" fails.
Result is cached at the process level.
Definition at line 1001 of file MediaWikiTestCase.php.
Referenced by TextPassDumperTest\testCheckpointGzip(), BackupDumperPageTest\testCurrentStubGzip(), BackupDumperPageTest\testXmlDumpsBackupUseCase(), and BackupDumperLoggerTest\testXmlDumpsBackupUseCaseLogging().
MediaWikiTestCase::checkPHPExtension | ( | $ | extName | ) | [protected] |
Check if $extName is a loaded PHP extension, will skip the test whenever it is not loaded.
string | $extName |
Definition at line 1025 of file MediaWikiTestCase.php.
Referenced by DiffHistoryBlobTest\setUp(), FormatMetadataTest\setUp(), JpegTest\setUp(), XMPTest\setUp(), CollationTest\setUp(), TiffTest\setUp(), ExifTest\setUp(), ExifBitmapTest\setUp(), ExifRotationTest\setUp(), RevisionTest\testCompressRevisionTextUtf8Gzip(), RevisionTest\testGetRevisionTextGzip(), RevisionTest\testGetRevisionTextUtf8LegacyGzip(), RevisionTest\testGetRevisionTextUtf8NativeGzip(), BitmapMetadataHandlerTest\testMultilingualCascade(), and PNGMetadataExtractorTest\testPngNativetZtxt().
Definition at line 402 of file MediaWikiTestCase.php.
Referenced by DatabaseTest\prefixAndQuote().
MediaWikiTestCase::getCliArg | ( | $ | offset | ) |
string | $offset |
Definition at line 673 of file MediaWikiTestCase.php.
References PHPUnitMaintClass\$additionalOptions.
Referenced by BagOStuffTest\setUp(), StoreBatchTest\setUp(), JobQueueTest\setUp(), and BagOStuffTest\testMerge().
MediaWikiTestCase::getDefaultWikitextNS | ( | ) | [protected] |
Returns the ID of a namespace that defaults to Wikitext.
MWException | If there is none. |
Definition at line 921 of file MediaWikiTestCase.php.
Referenced by TextPassDumperTest\addDBData(), EditPageTest\assertEdit(), RevisionStorageTest\createPage(), DifferenceEngineTest\getTitle(), WikiPageTest\newPage(), EditPageTest\testAutoMerge(), TextContentTest\testDeletionUpdates(), and WikitextContentTest\testGetSecondaryDataUpdates().
MediaWikiTestCase::getNewTempDirectory | ( | ) | [protected] |
obtains a new temporary directory
The obtained directory is enlisted to be removed (recursively with all its contained files) upon tearDown.
Definition at line 180 of file MediaWikiTestCase.php.
Referenced by TextPassDumperTest\checkpointHelper(), and MediaWikiMediaTestCase\setUp().
MediaWikiTestCase::getNewTempFile | ( | ) | [protected] |
Obtains a new temporary file name.
The obtained filename is enlisted to be removed upon tearDown
Definition at line 163 of file MediaWikiTestCase.php.
Referenced by TextPassDumperTest\checkpointHelper(), TextPassDumperTest\setUpStub(), CdbTest\testCdb(), BackupDumperPageTest\testCurrentStubGzip(), BackupDumperPageTest\testCurrentStubPlain(), BackupDumperPageTest\testFullStubPlain(), BackupDumperPageTest\testFullTextPlain(), TextPassDumperTest\testPlain(), BackupDumperLoggerTest\testPlain(), TextPassDumperTest\testPrefetchPlain(), GlobalTest\testWfMkdirParents(), BackupDumperPageTest\testXmlDumpsBackupUseCase(), and BackupDumperLoggerTest\testXmlDumpsBackupUseCaseLogging().
MediaWikiTestCase::hideDeprecated | ( | $ | function | ) |
Don't throw a warning if $function is deprecated and called later.
string | $function |
Definition at line 695 of file MediaWikiTestCase.php.
Referenced by RevisionTest\testConstructWithContent(), RevisionTest\testConstructWithText(), WikiPageTest\testDoEdit(), WikiPageTest\testDoQuickEdit(), LBFactoryTest\testGetLBFactoryClass(), RevisionTest\testGetRawText(), WikiPageTest\testGetRawText(), RevisionTest\testGetText(), WikiPageTest\testGetText(), GlobalVarConfigTest\testSet(), and GlobalTest\testSwapVarsTest().
static MediaWikiTestCase::isNotUnittest | ( | $ | table | ) | [static, private] |
Definition at line 620 of file MediaWikiTestCase.php.
References global.
MediaWikiTestCase::isWikitextNS | ( | $ | ns | ) | [protected] |
Returns true if the given namespace defaults to Wikitext according to $wgNamespaceContentModels.
int | $ns | The namespace ID to check |
Definition at line 904 of file MediaWikiTestCase.php.
Referenced by SearchEngineTest\addPages(), and SearchEngineTest\fetchIds().
static MediaWikiTestCase::listTables | ( | $ | db | ) | [static] |
DataBaseBase | $db |
Definition at line 631 of file MediaWikiTestCase.php.
MediaWikiTestCase::mergeMwGlobalArrayValue | ( | $ | name, |
$ | values | ||
) | [protected] |
Merges the given values into a MW global array variable.
Useful for setting some entries in a configuration array, instead of setting the entire array.
string | $name | The name of the global, as in wgFooBar |
array | $values | The array containing the entries to set in that global |
MWException | If the designated global is not an array. |
Definition at line 380 of file MediaWikiTestCase.php.
Referenced by RevisionTest\setUp(), TitleMethodsTest\setUp(), ApiRevisionDeleteTest\setUp(), SpecialMyLanguageTest\testFindTitle(), SpecialPageFactoryTest\testGetNames(), and SpecialPageFactoryTest\testGetPage().
MediaWikiTestCase::objectAssociativeSort | ( | array &$ | array | ) | [protected] |
Does an associative sort that works for objects.
array | $array |
Definition at line 825 of file MediaWikiTestCase.php.
MediaWikiTestCase::resetDB | ( | ) | [private] |
Empty all tables so they can be repopulated for tests.
Definition at line 558 of file MediaWikiTestCase.php.
MediaWikiTestCase::run | ( | PHPUnit_Framework_TestResult $ | result = null | ) |
Definition at line 93 of file MediaWikiTestCase.php.
Referenced by HooksTest\testFalseReturn(), HooksTest\testFatalError(), HooksTest\testNewStyleHookInteraction(), HooksTest\testNewStyleHooks(), and HooksTest\testUncallableFunction().
MediaWikiTestCase::setCliArg | ( | $ | offset, |
$ | value | ||
) |
string | $offset | |
mixed | $value |
Definition at line 684 of file MediaWikiTestCase.php.
References PHPUnitMaintClass\$additionalOptions, and $value.
MediaWikiTestCase::setMwGlobals | ( | $ | pairs, |
$ | value = null |
||
) | [protected] |
Definition at line 313 of file MediaWikiTestCase.php.
Referenced by BackupDumperPageTest\addDBData(), EditPageTest\assertEdit(), OutputPageTest\assertTransformCssMediaCase(), MessageCacheTest\configureLanguages(), TitleTest\secureAndSplitGlobals(), ImagePageTest\setUp(), AutoLoaderTest\setUp(), MessageTest\setUp(), HtmlTest\setUp(), GitInfoTest\setUp(), ResourceLoaderTest\setUp(), GlobalTest\setUp(), RevisionTest\setUp(), LanguageConverterTest\setUp(), TitleTest\setUp(), MediaWikiLangTestCase\setUp(), SvgTest\setUp(), FormatMetadataTest\setUp(), TestSample\setUp(), LinkFilterTest\setUp(), XmlTest\setUp(), BitmapMetadataHandlerTest\setUp(), BitmapScalingTest\setUp(), JpegTest\setUp(), LocalisationCacheTest\setUp(), ApiTestCase\setUp(), CssContentTest\setUp(), RevisionTestContentHandlerUseDB\setUp(), CSSMinTest\setUp(), WikiPageTestContentHandlerUseDB\setUp(), ExtraParserTest\setUp(), ExifTest\setUp(), TiffTest\setUp(), ApiCreateAccountTest\setUp(), ApiTestCaseUpload\setUp(), ImagePage404Test\setUp(), UploadFromUrlTest\setUp(), LocalFileTest\setUp(), ExifRotationTest\setUp(), ExifBitmapTest\setUp(), TextContentTest\setUp(), XmlSelectTest\setUp(), ContentHandlerTest\setUp(), SpecialPageTest\setUp(), ActionTest\setUp(), UserTest\setUp(), BlockTest\setUp(), ResourceLoaderTestCase\setUp(), MWNamespaceTest\setUp(), ApiEditPageTest\setUp(), JobQueueTest\setUp(), TagHookTest\setUp(), RCCacheEntryFactoryTest\setUp(), SearchUpdateTest\setUp(), OldChangesListTest\setUp(), WfParseUrlTest\setUp(), MediaWikiPageLinkRendererTest\setUp(), MediaWikiTitleCodecTest\setUp(), RepoGroupTest\setUpForeignRepo(), SpecialPreferencesTest\testBug41337(), FileTest\testCanAnimateThumbIfAppropriate(), RevisionTest\testCompressRevisionTextUtf8Gzip(), HtmlTest\testElementBasics(), ExternalStoreTest\testExternalFetchFromURL(), SpecialMyLanguageTest\testFindTitle(), RepoGroupTest\testForEachForeignRepoNone(), LinkerTest\testFormatComment(), FileTest\testGenerateBucketsIfNeeded(), ContentHandlerTest\testGetContentText_NonTextContent_fail(), ContentHandlerTest\testGetContentText_NonTextContent_ignore(), ContentHandlerTest\testGetContentText_NonTextContent_serialize(), ContentHandlerTest\testGetContentText_Null(), ContentHandlerTest\testGetContentText_TextContent(), ConfigFactoryTest\testGetDefaultInstance(), WebRequestTest\testGetIP(), WebRequestTest\testGetIpLackOfRemoteAddrThrowAnException(), ResourceLoaderTest\testGetLoadScript(), SpecialPageFactoryTest\testGetLocalNameFor(), ResourceLoaderStartupModuleTest\testGetModuleRegistrations(), WikiPageTest\testGetRedirectTarget(), FileTest\testGetThumbnailBucket(), SpecialPageFactoryTest\testGetTitleForAlias(), RepoGroupTest\testHasForeignRepoNegative(), RequestContextTest\testImportScopedSession(), MessageTest\testInContentLanguage(), MessageTest\testInContentLanguageOverride(), MWExceptionTest\testisCommandLine(), TextContentTest\testIsCountable(), WikiPageTest\testIsCountable(), TitleTest\testIsValidMoveOperation(), MWExceptionTest\testJsonserializeexceptionBacktracingDisabled(), MWExceptionTest\testJsonserializeexceptionBacktracingEnabled(), MWExceptionTest\testJsonserializeexceptionKeys(), OutputPageTest\testMakeResourceLoaderLink(), ExifRotationTest\testMetadataAutoRotate(), ExifRotationTest\testMetadataAutoRotateUnsupported(), ExifRotationTest\testMetadataNoAutoRotate(), BitmapMetadataHandlerTest\testMultilingualCascade(), MailAddressTest\testNewFromUser(), MediaWikiSiteTest\testNormalizePageTitle(), ResourceLoaderStartupModuleTest\testRegistrationsMinified(), SanitizerTest\testRemovehtmltagsOnHtml5Tags(), SpecialPageFactoryTest\testResolveAlias(), ExifRotationTest\testRotationRenderingNoAutoRotate(), MWExceptionTest\testRunHooks(), SpecialSearchTest\testSearchTermIsNotExpanded(), MediaWikiTestCaseTest\testSetGlobalsAreRestoredOnTearDown(), ArticleTablesTest\testTemplatelinksUsesContentLanguage(), ApiQueryTest\testTitlesGetNormalized(), MailAddressTest\testToString(), LinksUpdateTest\testUpdate_categorylinks(), LinksUpdateTest\testUpdate_langlinks(), LinksUpdateTest\testUpdate_page_props_without_sortkey(), ApiUploadTest\testUploadChunks(), ApiUploadTest\testUploadStash(), MWExceptionTest\testUseMessageCache(), MWExceptionTest\testUseOutputPage(), TimeAdjustTest\testUserAdjust(), LinkerTest\testUserLink(), and WfExpandUrlTest\testWfExpandUrl().
MediaWikiTestCase::setUp | ( | ) | [protected] |
Reimplemented in FetchTextTest, MaintenanceTest, TextPassDumperTest, BackupDumperPageTest, DumpTestCase, TestORMRowTest, NewParserTest, LanguageClassesTestCase, FormOptionsInitializationTest, SideBarTest, RevisionStorageTest, WikiPageTest, MagicVariableTest, PreferencesTest, DatabaseSqliteTest, MediaWikiTitleCodecTest, PasswordTestCase, MediaWikiPageLinkRendererTest, FormOptionsTest, FauxResponseTest, WfParseUrlTest, OldChangesListTest, LinksUpdateTest, SearchUpdateTest, RCCacheEntryFactoryTest, TitlePermissionTest, SearchEngineTest, ApiOptionsTest, TagHookTest, DifferenceEngineTest, LogFormatterTest, JobQueueTest, UploadStashTest, ParserPreloadTest, ApiEditPageTest, FileBackendTest, JpegMetadataExtractorTest, MWNamespaceTest, ResourceLoaderTestCase, ApiRevisionDeleteTest, BlockTest, ActionTest, ApiQueryTest, BloomCacheRedisTest, DatabaseTest, PathRouterTest, UserTest, ArticleTest, ContentHandlerTest, DatabaseSQLTest, StoreBatchTest, PreprocessorTest, SpecialPageTest, ApiParseTest, ApiPurgeTest, TextContentTest, DjVuTest, ExifBitmapTest, ExifRotationTest, MediaWikiMediaTestCase, TitleMethodsTest, XmlSelectTest, ApiBlockTest, ApiCreateAccountTest, ApiTestCaseUpload, ApiUnblockTest, CollationTest, WikitextContentHandlerTest, ErrorPageErrorTest, ThrottledErrorTest, ExtraParserTest, ImagePage404Test, LocalFileTest, ExifTest, TiffTest, UploadFromUrlTest, ZipDirectoryReaderTest, ApiQueryAllPagesTest, ApiTestCase, ApiWatchTest, MessageCacheTest, CssContentTest, BadTitleErrorTest, CSSMinTest, GIFHandlerTest, PNGHandlerTest, XCFHandlerTest, BagOStuffTest, RevisionTestContentHandlerUseDB, SpecialMIMESearchTest, UploadBaseTest, CdbTest, WikiPageTestContentHandlerUseDB, GenderCacheTest, LocalisationCacheTest, JpegTest, PNGMetadataExtractorTest, SVGMetadataExtractorTest, XMPTest, SanitizerTest, SiteConfigurationTest, WebRequestTest, LinkFilterTest, BitmapMetadataHandlerTest, BitmapScalingTest, FormatMetadataTest, GIFMetadataExtractorTest, SvgTest, MWTimestampTest, TidyTest, TestSample, XmlTest, GitInfoTest, GlobalTest, LanguageConverterTest, ResourceLoaderTest, RevisionTest, TitleTest, MediaWikiLangTestCase, HtmlTest, MimeMagicTest, MWDebugTest, DiffHistoryBlobTest, HooksTest, MessageTest, ResourceLoaderModuleTest, ImagePageTest, TimeAdjustTest, and AutoLoaderTest.
Definition at line 194 of file MediaWikiTestCase.php.
static MediaWikiTestCase::setupTestDB | ( | DatabaseBase $ | db, |
$ | prefix | ||
) | [static] |
Creates an empty skeleton of the wiki database by cloning its structure to equivalent tables using the given $prefix.
Then sets MediaWiki to use the new set of tables (aka schema) instead of the original set.
This is used to generate a dummy table set, typically consisting of temporary tables, that will be used by tests instead of the original wiki database tables.
DatabaseBase | $db | The database connection |
string | $prefix | The prefix to use for the new table set (aka schema). |
MWException | If the database table prefix is already $prefix |
Definition at line 524 of file MediaWikiTestCase.php.
MediaWikiTestCase::stashMwGlobals | ( | $ | globalKeys | ) | [protected] |
Stashes the global, will be restored in tearDown()
Individual test functions may override globals through the setMwGlobals() function or directly. When directly overriding globals their keys should first be passed to this method in setUp to avoid breaking global state for other tests
That way all other tests are executed with the same settings (instead of using the unreliable local settings for most tests and fix it only for some tests).
array | string | $globalKeys | Key to the global variable, or an array of keys. |
Exception | When trying to stash an unset global |
Definition at line 340 of file MediaWikiTestCase.php.
Referenced by GlobalVarConfigTest\maybeStashGlobal(), MediaWikiTestCaseTest\testExceptionThrownWhenStashingNonExistentGlobals(), and MediaWikiTestCaseTest\testStashedGlobalsAreRestoredOnTearDown().
static MediaWikiTestCase::stripStringKeys | ( | &$ | r | ) | [static, protected] |
Utility function for eliminating all string keys from an array.
Useful to turn a database result row as returned by fetchRow() into a pure indexed array.
mixed | $r | The array to remove string keys from. |
Definition at line 843 of file MediaWikiTestCase.php.
MediaWikiTestCase::tearDown | ( | ) | [protected] |
Reimplemented in NewParserTest, MaintenanceTest, TestORMRowTest, LanguageClassesTestCase, BloomCacheRedisTest, RevisionStorageTest, ApiOptionsTest, JobQueueTest, StoreBatchTest, RevisionTest, SearchEngineTest, LogFormatterTest, WikiPageTest, ContentHandlerTest, UploadStashTest, ApiEditPageTest, TitleMethodsTest, ApiQueryTest, ParserPreloadTest, LanguageConverterTest, TestSample, GlobalTest, ApiTestCaseUpload, UploadBaseTest, ArticleTest, XmlSelectTest, DatabaseTest, BaseDumpTest, MWDebugTest, ErrorPageErrorTest, ThrottledErrorTest, BadTitleErrorTest, WebRequestTest, ConfigFactoryTest, and UIDGeneratorTest.
Definition at line 223 of file MediaWikiTestCase.php.
Referenced by MediaWikiTestCaseTest\testSetGlobalsAreRestoredOnTearDown(), and MediaWikiTestCaseTest\testStashedGlobalsAreRestoredOnTearDown().
static MediaWikiTestCase::teardownTestDB | ( | ) | [static] |
Restores MediaWiki to using the table set (table prefix) it was using before setupTestDB() was called.
Useful if we need to perform database operations after the test run has finished (such as saving logs or profiling info).
Definition at line 492 of file MediaWikiTestCase.php.
Referenced by MediaWikiPHPUnitBootstrap\__destruct().
Make sure MediaWikiTestCase extending classes have called their parent setUp method.
Definition at line 275 of file MediaWikiTestCase.php.
static MediaWikiTestCase::unprefixTable | ( | $ | tableName | ) | [static, private] |
Definition at line 614 of file MediaWikiTestCase.php.
Definition at line 150 of file MediaWikiTestCase.php.
References $useTemporaryTables.
MediaWikiTestCase::$called = array() [private] |
$called tracks whether the setUp and tearDown method has been called.
class extending MediaWikiTestCase usually override setUp and tearDown but forget to call the parent.
The array format takes a method name as key and anything as a value. By asserting the key exist, we know the child class has called the parent.
This property must be private, we do not want child to override it, they should call the appropriate parent method instead.
Definition at line 19 of file MediaWikiTestCase.php.
Referenced by HtmlCheckMatrixTest\testValidateCallsUserDefinedValidationCallback().
DatabaseBase MediaWikiTestCase::$db [protected] |
Reimplemented in DatabaseSqliteTest, and DatabaseTest.
Definition at line 30 of file MediaWikiTestCase.php.
Referenced by DatabaseMysqlBaseTest\getMockForViews(), DatabaseMysqlBaseTest\testAddIdentifierQuotes(), ORMTableTest\testIgnoreErrorsOverride(), DatabaseMysqlBaseTest\testIsView(), and DatabaseMysqlBaseTest\testListviews().
MediaWikiTestCase::$dbSetup = false [static, private] |
Definition at line 39 of file MediaWikiTestCase.php.
Holds original values of MediaWiki configuration settings to be restored in tearDown().
See also setMwGlobals().
Definition at line 60 of file MediaWikiTestCase.php.
MediaWikiTestCase::$oldTablePrefix = false [static, private] |
Definition at line 40 of file MediaWikiTestCase.php.
int MediaWikiTestCase::$phpErrorLevel [private] |
Original value of PHP's error_reporting setting.
Definition at line 46 of file MediaWikiTestCase.php.
MediaWikiTestCase::$reuseDB = false [static, private] |
Definition at line 38 of file MediaWikiTestCase.php.
array MediaWikiTestCase::$supportedDBs [protected] |
array( 'mysql', 'sqlite', 'postgres', 'oracle' )
Definition at line 71 of file MediaWikiTestCase.php.
Definition at line 35 of file MediaWikiTestCase.php.
Holds the paths of temporary files/directories created through getNewTempFile, and getNewTempDirectory.
Definition at line 53 of file MediaWikiTestCase.php.
MediaWikiTestCase::$users [static] |
Reimplemented in UploadStashTest.
Definition at line 25 of file MediaWikiTestCase.php.
MediaWikiTestCase::$useTemporaryTables = true [static, private] |
Definition at line 37 of file MediaWikiTestCase.php.
Referenced by usesTemporaryTables().
const MediaWikiTestCase::DB_PREFIX = 'unittest_' |
const MediaWikiTestCase::ORA_DB_PREFIX = 'ut_' |
Definition at line 66 of file MediaWikiTestCase.php.