MediaWiki  1.29.2
MediaWikiTestCase Class Reference

Inherits PHPUnit_Framework_TestCase.

Inherited by AbstractChangesListSpecialPageTestCase, ActionTest, ApiContinuationManagerTest, ApiDocumentationTest, ApiFormatTestBase, ApiMessageTest, ApiModuleManagerTest, ApiOpenSearchTest, ApiResultTest, ArrayDiffFormatterTest, ArticleTest, AutoLoaderTest, BadTitleErrorTest, BagOStuffTest, BalancerTest, BaseDumpTest, BatchRowUpdateTest, BitmapMetadataHandlerTest, BitmapScalingTest, BotPasswordTest, CachingSiteStoreTest, CaptchaPreAuthenticationProviderTest, CategoryMembershipChangeJobTest, CdnCacheUpdateTest, CentralIdLookupTest, ChangesListBooleanFilterGroupTest, ChangesListBooleanFilterTest, ChangesListFilterGroupTest, ChangesListFilterTest, ChangesListStringOptionsFilterGroupTest, ClassicInterwikiLookupTest, ComposerJsonTest, ComposerLockTest, ConfigFactoryTest, ContentHandlerSanityTest, ContentHandlerTest, DatabaseMysqlBaseTest, DatabaseSqliteTest, DatabaseSQLTest, DatabaseTest, DBSiteStoreTest, DeferredUpdatesTest, DifferenceEngineTest, DiffHistoryBlobTest, DiffOpTest, DiffTest, DummyExtensionsTest, ErrorPageErrorTest, ExifTest, ExpressionTest, ExtensionProcessorTest, ExtensionRegistryTest, ExternalStoreTest, ExtraParserTest, FauxResponseTest, FetchTextTest, FileBackendDBRepoWrapperTest, FileBackendTest, FileRepoTest, ForeignTitleTest, FormatJsonTest, FormOptionsInitializationTest, FormOptionsTest, GadgetsTest, GitInfoTest, GlobalTest, GlobalVarConfigTest, GlobalWithDBTest, HashConfigTest, HashSiteStoreTest, HooksTest, HtmlAutoCompleteSelectFieldTest, HtmlCheckMatrixTest, HTMLFormTest, HttpErrorTest, HttpTest, ImageListPagerTest, ImportLinkCacheIntegrationTest, InstallDocFormatterTest, InterwikiLookupAdapterTest, InterwikiTest, IPTCTest, JobQueueTest, JobTest, JpegMetadataExtractorTest, JsonContentHandlerTest, LanguageClassesTestCase, LBFactoryTest, LicensesTest, LocalFileTest, LocalIdLookupTest, LocalisationCacheTest, MagicVariableTest, MailAddressTest, MaintenanceTest, MediaHandlerTest, MediaWiki\Auth\AbstractAuthenticationProviderTest, MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest, MediaWiki\Auth\AbstractPreAuthenticationProviderTest, MediaWiki\Auth\AbstractPrimaryAuthenticationProviderTest, MediaWiki\Auth\AbstractSecondaryAuthenticationProviderTest, MediaWiki\Auth\AuthenticationRequestTest, MediaWiki\Auth\AuthenticationRequestTestCase, MediaWiki\Auth\AuthenticationResponseTest, MediaWiki\Auth\AuthManagerTest, MediaWiki\Auth\AuthPluginPrimaryAuthenticationProviderTest, MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProviderTest, MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProviderTest, MediaWiki\Auth\LegacyHookPreAuthenticationProviderTest, MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest, MediaWiki\Auth\ResetPasswordSecondaryAuthenticationProviderTest, MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest, MediaWiki\Auth\ThrottlePreAuthenticationProviderTest, MediaWiki\Auth\ThrottlerTest, MediaWiki\Logger\LegacyLoggerTest, MediaWiki\Logger\Monolog\AvroFormatterTest, MediaWiki\Logger\Monolog\KafkaHandlerTest, MediaWiki\Logger\Monolog\LineFormatterTest, MediaWiki\Logger\MonologSpiTest, MediaWiki\Session\BotPasswordSessionProviderTest, MediaWiki\Session\CookieSessionProviderTest, MediaWiki\Session\ImmutableSessionProviderWithCookieTest, MediaWiki\Session\MetadataMergeExceptionTest, MediaWiki\Session\PHPSessionHandlerTest, MediaWiki\Session\SessionBackendTest, MediaWiki\Session\SessionIdTest, MediaWiki\Session\SessionInfoTest, MediaWiki\Session\SessionManagerTest, MediaWiki\Session\SessionProviderTest, MediaWiki\Session\SessionTest, MediaWiki\Session\TokenTest, MediaWiki\Session\UserInfoTest, MediaWikiLangTestCase, MediaWikiMediaTestCase, MediaWikiServicesTest, MediaWikiTest, MediaWikiTestCaseTest, MediaWikiTitleCodecTest, MemcachedBagOStuffTest, MergeHistoryTest, MigrateFileRepoLayoutTest, MovePageTest, MultiConfigTest, MultiWriteBagOStuffTest, MWCryptHKDFTest, MWDebugTest, MWExceptionHandlerTest, MWExceptionTest, MWGrantsTest, MWNamespaceTest, NaiveForeignTitleFactoryTest, NaiveImportTitleFactoryTest, NamespaceAwareForeignTitleFactoryTest, NamespaceImportTitleFactoryTest, ObjectCacheTest, OracleInstallerTest, ParserOutputTest, ParserPreloadTest, PasswordPolicyChecksTest, PasswordTest, PasswordTestCase, PathRouterTest, PNGMetadataExtractorTest, PoolCounterTest, PreferencesTest, PrefixUniquenessTest, PreprocessorTest, QueryAllSpecialPagesTest, QuestyCaptchaTest, RCFeedIntegrationTest, ReadOnlyErrorTest, ReadOnlyModeTest, RecentChangeTest, RefreshLinksPartitionTest, RemexDriverTest, ReplicatedBagOStuffTest, RepoGroupTest, RequestContextTest, ResourceLoaderTestCase, ResourcesTest, RESTBagOStuffTest, RevisionStorageTest, RevisionTest, SearchIndexFieldTest, SearchUpdateTest, SiteConfigurationTest, SiteListTest, SiteTest, SkinFactoryTest, SkinTemplateTest, SpecialMIMESearchTest, SpecialMyLanguageTest, SpecialPageAliasTest, SpecialPageFactoryTest, SpecialPageTest, SpecialPageTestBase, SpecialPreferencesTest, SpecialSearchTest, StoreBatchTest, StructureTest, SubpageImportTitleFactoryTest, SVGMetadataExtractorTest, SwiftFileBackendTest, TagHookTest, TemplateParserTest, ThrottledErrorTest, TidyTest, TiffTest, TitleBlacklistPreAuthenticationProviderTest, TitleTest, TitleValueTest, UncategorizedCategoriesPageTest, UploadStashTest, UserArrayFromResultTest, UserGroupMembershipTest, UserNotLoggedInTest, UserPasswordPolicyTest, UserTest, WatchedItemIntegrationTest, WatchedItemStoreIntegrationTest, WatchedItemStoreUnitTest, WatchedItemUnitTest, WebPHandlerTest, WebRequestTest, WfAppendQueryTest, WfArrayPlus2dTest, WfAssembleUrlTest, WfBaseNameTest, WfBCP47Test, WfEscapeShellArgTest, WfExpandUrlTest, WfGetCallerTest, WfParseUrlTest, WfRemoveDotSegmentsTest, WfShellExecTest, WfShorthandToIntegerTest, WfThumbIsStandardTest, WfTimestampTest, WfUrlencodeTest, XmlSelectTest, and XmlTest.

Collaboration diagram for MediaWikiTestCase:

Public Member Functions

 __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 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 (IMaintainableDatabase $db)
 
static prepareServices (Config $bootstrapConfig)
 Prepare service configuration for unit testing. More...
 
static setUpBeforeClass ()
 
static setupTestDB (Database $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

const DB_PREFIX = 'unittest_'
 Table name prefixes. More...
 
const ORA_DB_PREFIX = 'ut_'
 

Static Public Attributes

static TestUser[] $users
 

Protected Member Functions

 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.', $namespace=null)
 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...
 
 setTemporaryHook ( $hookName, $handler)
 Create a temporary hook handler which will be reset by tearDown. More...
 
 setUp ()
 
 stashMwGlobals ( $globalKeys)
 Stashes the global, will be restored in tearDown() More...
 
 tearDown ()
 

Static Protected Member Functions

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 (IMaintainableDatabase $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

Database $db
 Primary database. More...
 
array $supportedDBs
 
array $tablesUsed = []
 

Private Member Functions

 addCoreDBData ()
 
 createMock2 ( $originalClassName)
 Return a test double for the specified class. More...
 
 doLightweightServiceReset ()
 Resets some well known services that typically have state that may interfere with unit tests. More...
 
 oncePerClass ()
 
 resetDB ( $db, $tablesUsed)
 Empty all tables so they can be repopulated for tests. More...
 
 restoreLoggers ()
 Restores loggers replaced by setLogger(). More...
 

Static Private Member Functions

static canShallowCopy ( $value)
 Check if we can back up a value by performing a shallow copy. More...
 
static installTestServices (ConfigFactory $oldConfigFactory, MediaWikiServices $newServices)
 
static isNotUnittest ( $table)
 
static makeTestConfig (Config $baseConfig=null, Config $customOverrides=null)
 Create a config suitable for testing, based on a base config, default overrides, and custom overrides. More...
 
static makeTestConfigFactoryInstantiator (ConfigFactory $oldFactory, array $configurations)
 
static unprefixTable (&$tableName, $ind, $prefix)
 

Private Attributes

 $called = []
 $called tracks whether the setUp and tearDown method has been called. More...
 
LoggerInterface[] $loggers = []
 Holds original loggers which have been replaced by setLogger() More...
 
array $mwGlobals = []
 Holds original values of MediaWiki configuration settings to be restored in tearDown(). More...
 
array $mwGlobalsToUnset = []
 Holds list of MediaWiki configuration settings to be unset in tearDown(). More...
 
int $phpErrorLevel
 Original value of PHP's error_reporting setting. More...
 
array $tmpFiles = []
 Holds the paths of temporary files/directories created through getNewTempFile, and getNewTempDirectory. More...
 

Static Private Attributes

static $dbSetup = false
 
static $oldTablePrefix = ''
 
static $reuseDB = false
 
static MediaWikiServices null $serviceLocator = null
 The service locator created by prepareServices(). More...
 
static $useTemporaryTables = true
 

Detailed Description

Since
1.18
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 13 of file MediaWikiTestCase.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWikiTestCase::__construct (   $name = null,
array  $data = [],
  $dataName = '' 
)

◆ __destruct()

MediaWikiTestCase::__destruct ( )
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 123 of file MediaWikiTestCase.php.

References class.

Member Function Documentation

◆ __call()

MediaWikiTestCase::__call (   $func,
  $args 
)
Since
1.18
Parameters
string$func
array$args
Returns
mixed
Exceptions
MWException

Reimplemented in MWNamespaceTest.

Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1301 of file MediaWikiTestCase.php.

References $args, and class.

◆ addCoreDBData()

MediaWikiTestCase::addCoreDBData ( )
private

◆ addDBData()

MediaWikiTestCase::addDBData ( )

Stub.

Subclasses may override this to prepare the database. Called before every test run (test function or data set).

See also
addDBDataOnce()
resetDB()
Since
1.18

Reimplemented in BotPasswordTest, BackupDumperLoggerTest, TextPassDumperDatabaseTest, BackupDumperPageTest, LocalIdLookupTest, and BlockTest.

Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1007 of file MediaWikiTestCase.php.

Referenced by run().

◆ addDBDataOnce()

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

See also
addDBData()
resetDB()
Since
1.27

Reimplemented in FetchTextTest, MediaWiki\Session\BotPasswordSessionProviderTest, CategoryMembershipChangeTest, ContentHandlerTest, LinksUpdateTest, SearchEngineTest, ApiQueryBasicTest, ApiQueryContinueTest, ApiQueryContinue2Test, ApiBlockTest, CategoryMembershipChangeJobTest, MessageCacheTest, SearchEnginePrefixTest, PrefixSearchTest, GenderCacheTest, MergeHistoryTest, and SpecialMyLanguageTest.

Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 995 of file MediaWikiTestCase.php.

Referenced by run().

◆ addTmpFiles()

MediaWikiTestCase::addTmpFiles (   $files)
protected

◆ arrayWrap()

MediaWikiTestCase::arrayWrap ( array  $elements)
protected

Utility method taking an array of elements and wrapping each element in its own array.

Useful for data providers that only return a single argument.

Since
1.20
Parameters
array$elements
Returns
array
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1477 of file MediaWikiTestCase.php.

Referenced by SiteTest\instanceProvider(), SiteListTest\siteArrayProvider(), and SiteListTest\siteListProvider().

◆ assertArrayEquals()

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.

Since
1.20
Parameters
array$expected
array$actual
bool$orderedIf the order of the values should match
bool$namedIf the keys should match
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1498 of file MediaWikiTestCase.php.

References objectAssociativeSort().

Referenced by BotPasswordTest\testCanonicalizeLoginData(), ResourcesTest\testCommentedLocalFileReferences(), SpecialWatchlistTest\testFetchOptionsFromRequest(), ChangesListSpecialPageTest\testFilterUserExpLevel(), SiteListTest\testGetGlobalIdentifiers(), ApiModuleManagerTest\testGetGroups(), DjVuTest\testGetImageSize(), ComposerLockTest\testGetInstalledDependencies(), ChangesListBooleanFilterTest\testGetJsData(), ChangesListBooleanFilterGroupTest\testGetJsData(), ChangesListStringOptionsFilterGroupTest\testGetJsData(), ApiModuleManagerTest\testGetNames(), ApiModuleManagerTest\testGetNamesWithClasses(), DjVuTest\testGetPageDimensions(), TextContentTest\testGetParserOutput(), UserPasswordPolicyTest\testGetPoliciesForGroups(), UserPasswordPolicyTest\testGetPoliciesForUser(), ComposerJsonTest\testGetRequiredDependencies(), ChangesListSpecialPageTest\testGetStructuredFilterJsData(), MediaWiki\Session\CookieSessionProviderTest\testGetVaryCookies(), PoolCounterTest\testHashKeyIntoSlots(), WikitextStructureTest\testHeadingsNone(), UserPasswordPolicyTest\testMaxOfPolicies(), StatusTest\testOkAndErrorsGetters(), AbstractChangesListSpecialPageTestCase\testParseParameters(), SiteListTest\testSerialization(), ChangesListFilterTest\testSetAsSupersetOf(), and LinksUpdateTest\testUpdate_pagelinks().

◆ assertHTMLEquals()

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

Since
1.20
Parameters
string$expectedHTML on oneline
string$actualHTML on oneline
string$msgOptional message
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1529 of file MediaWikiTestCase.php.

◆ assertSelect()

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.

Since
1.20
Parameters
string | array$tableThe table(s) to query
string | array$fieldsThe columns to include in the result (and to sort by)
string | array$condition"where" condition(s)
array$expectedRowsAn array of arrays giving the expected rows.
Exceptions
MWExceptionIf this test cases's needsDB() method doesn't return true. Test cases can use " Database" to enable database test support, or list the tables under testing in $this->tablesUsed, or override the needsDB() method.
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1437 of file MediaWikiTestCase.php.

References $db, $res, as, DB_SLAVE, needsDB(), stripStringKeys(), wfGetCaller(), and wfGetDB().

Referenced by LinksUpdateTest\assertLinksUpdate(), and LinksUpdateTest\assertRecentChangeByCategorization().

◆ assertType()

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.

Since
1.20
Parameters
string$type
mixed$actual
string$message
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1605 of file MediaWikiTestCase.php.

References $type.

Referenced by assertTypeOrValue(), MediaWiki\Auth\AbstractAuthenticationProviderTest\testAbstractAuthenticationProvider(), ActionTest\testActionFactory(), MediaWiki\Auth\AuthenticationRequestTest\testBasics(), JobQueueTest\testDeduplicationWhileClaimed(), MediaWiki\Auth\AuthenticationRequestTestCase\testGetFieldInfo(), BagOStuffTest\testGetScopedLock(), and DatabaseTest\testMutators().

◆ assertTypeOrValue()

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.

Since
1.20
Parameters
string$type
mixed$actual
mixed$value
string$message
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1586 of file MediaWikiTestCase.php.

References $type, $value, and assertType().

Referenced by SiteTest\testGetGlobalId(), SiteTest\testGetLanguageCode(), and SiteTest\testGetPath().

◆ assertValidHtmlDocument()

MediaWikiTestCase::assertValidHtmlDocument (   $html)
protected

Asserts that the given string is valid HTML document.

Since
1.23
Note
Will mark the test as skipped if the "tidy" module is not installed.
This ignores $wgUseTidy, so we can check for valid HTML even (and especially) when automatic tidying is disabled.
Parameters
string$htmlA complete HTML document
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1756 of file MediaWikiTestCase.php.

References $GLOBALS, $html, MWTidy\checkErrors(), and MWTidy\isEnabled().

Referenced by assertValidHtmlSnippet().

◆ assertValidHtmlSnippet()

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.

Since
1.23
Note
Will mark the test as skipped if the "tidy" module is not installed.
This ignores $wgUseTidy, so we can check for valid HTML even (and especially) when automatic tidying is disabled.
Parameters
string$htmlAn HTML snippet (treated as the contents of the body tag).
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1740 of file MediaWikiTestCase.php.

References $html, and assertValidHtmlDocument().

◆ canShallowCopy()

static MediaWikiTestCase::canShallowCopy (   $value)
staticprivate

Check if we can back up a value by performing a shallow copy.

Values which fail this test are copied recursively.

Parameters
mixed$value
Returns
bool True if a shallow copy will do; false if a deep copy is required.
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 678 of file MediaWikiTestCase.php.

References $value, and as.

◆ checkDbIsSupported()

MediaWikiTestCase::checkDbIsSupported ( )
protected
Exceptions
MWException
Since
1.18
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1378 of file MediaWikiTestCase.php.

References $supportedDBs.

Referenced by run().

◆ checkPHPExtension()

◆ createMock2()

MediaWikiTestCase::createMock2 (   $originalClassName)
private

Return a test double for the specified class.

Parameters
string$originalClassName
Returns
PHPUnit_Framework_MockObject_MockObject
Exceptions
Exception
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1320 of file MediaWikiTestCase.php.

◆ dbPrefix()

MediaWikiTestCase::dbPrefix ( )
Returns
string
Since
1.18
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 919 of file MediaWikiTestCase.php.

References DB_PREFIX, and ORA_DB_PREFIX.

Referenced by DatabaseTest\prefixAndQuote(), and setupAllTestDBs().

◆ doLightweightServiceReset()

MediaWikiTestCase::doLightweightServiceReset ( )
private

Resets some well known services that typically have state that may interfere with unit tests.

This is a lightweight alternative to resetGlobalServices().

Note
There is no guarantee that no references remain to stale service instances destroyed by a call to doLightweightServiceReset().
Exceptions
MWExceptionif called outside of PHPUnit tests.
See also
resetGlobalServices()
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 344 of file MediaWikiTestCase.php.

References $services, $wgRequest, ObjectCache\clear(), FileBackendGroup\destroySingleton(), JobQueueGroup\destroySingletons(), global, MediaWiki\Session\SessionManager\resetCache(), and RequestContext\resetMain().

Referenced by run().

◆ getCliArg()

MediaWikiTestCase::getCliArg (   $offset)

◆ getDefaultWikitextNS()

◆ getExternalStoreDatabaseConnections()

static MediaWikiTestCase::getExternalStoreDatabaseConnections ( )
staticprotected

Gets master database connections for all of the ExternalStoreDB stores configured in $wgDefaultExternalStore.

Returns
Database[] Array of Database master connections
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1208 of file MediaWikiTestCase.php.

References $wgDefaultExternalStore, array(), as, ExternalStore\getStoreObject(), global, and list.

Referenced by setupExternalStoreTestDBs().

◆ getMutableTestUser()

static MediaWikiTestCase::getMutableTestUser (   $groups = [])
static

Convenience method for getting a mutable test user.

Since
1.28
Parameters
string[]$groupsGroups the test user should be added in.
Returns
TestUser
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 158 of file MediaWikiTestCase.php.

References TestUserRegistry\getMutableTestUser().

Referenced by LocalIdLookupTest\addDBData(), GenderCacheTest\addDBDataOnce(), EnhancedChangesListTest\getCategorizationChange(), OldChangesListTest\getContext(), RCCacheEntryFactoryTest\getContext(), EnhancedChangesListTest\getEditChange(), OldChangesListTest\getEditChange(), OldChangesListTest\getLogChange(), OldChangesListTest\getNewBotEditChange(), ApiQueryWatchlistRawIntegrationTest\setUp(), BotPasswordTest\setUp(), ApiQueryWatchlistIntegrationTest\setUp(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testAccountCreation(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testAccountCreationEmail(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testAuthentication(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testAuthentication(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testBasics(), UserTest\testCheckAndSetTouched(), UserTest\testEquals(), ApiBaseTest\testErrorArrayToStatus(), UserTest\testFindUsersByGroup(), UserTest\testGetEditCount(), UserTest\testIncEditCount(), UserTest\testLoggedIn(), RCCacheEntryFactoryTest\testNewForDeleteChange(), RCCacheEntryFactoryTest\testNewForRevUserDeleteChange(), RCCacheEntryFactoryTest\testNewFromRecentChange(), UserTest\testOptions(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testProviderChangeAuthenticationData(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testProviderChangeAuthenticationDataEmail(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testSetPasswordResetFlag(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testTestUserCanAuthenticate(), and MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testTestUserCanAuthenticate().

◆ getNewTempDirectory()

MediaWikiTestCase::getNewTempDirectory ( )
protected

◆ getNewTempFile()

◆ getTestSysop()

static MediaWikiTestCase::getTestSysop ( )
static

Convenience method for getting an immutable admin test user.

Since
1.28
Parameters
string[]$groupsGroups the test user should be added to.
Returns
TestUser
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 170 of file MediaWikiTestCase.php.

References getTestUser().

Referenced by RCFeedIntegrationTest\testNotify(), ChangesListSpecialPageTest\testRcHidepatrolledFilter(), ChangesListSpecialPageTest\testRcHidepatrolledHideunpatrolledFilter(), and ChangesListSpecialPageTest\testRcHideunpatrolledFilter().

◆ getTestUser()

◆ hideDeprecated()

MediaWikiTestCase::hideDeprecated (   $function)

◆ insertPage()

MediaWikiTestCase::insertPage (   $pageName,
  $text = 'Sample page for unit test.',
  $namespace = null 
)
protected

Insert a new page.

Should be called from addDBData().

Since
1.25 ($namespace in 1.28)
Parameters
string | title$pageNamePage name or title
string$textPage's content
int$namespaceNamespace id (name cannot already contain namespace)
Returns
array Title object and page id
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 953 of file MediaWikiTestCase.php.

References $page, $title, $user, WikiPage\factory(), ContentHandler\makeContent(), and Title\newFromText().

Referenced by MergeHistoryTest\addDBDataOnce(), PrefixSearchTest\addDBDataOnce(), SearchEnginePrefixTest\addDBDataOnce(), CategoryMembershipChangeJobTest\addDBDataOnce(), SearchEngineTest\addDBDataOnce(), LinksUpdateTest\addDBDataOnce(), ContentHandlerTest\addDBDataOnce(), and CategoryMembershipChangeTest\addDBDataOnce().

◆ installTestServices()

static MediaWikiTestCase::installTestServices ( ConfigFactory  $oldConfigFactory,
MediaWikiServices  $newServices 
)
staticprivate

◆ isNotUnittest()

static MediaWikiTestCase::isNotUnittest (   $table)
staticprivate

◆ isUsingExternalStoreDB()

static MediaWikiTestCase::isUsingExternalStoreDB ( )
staticprotected

Check whether ExternalStoreDB is being used.

Returns
bool True if it's being used
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1232 of file MediaWikiTestCase.php.

References $wgDefaultExternalStore, array(), as, and global.

◆ isWikitextNS()

MediaWikiTestCase::isWikitextNS (   $ns)
protected

Returns true if the given namespace defaults to Wikitext according to $wgNamespaceContentModels.

Parameters
int$nsThe namespace ID to check
Returns
bool
Since
1.21
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1622 of file MediaWikiTestCase.php.

References CONTENT_MODEL_WIKITEXT, and global.

Referenced by PrefixSearchTest\addDBDataOnce(), SearchEnginePrefixTest\addDBDataOnce(), SearchEngineTest\addDBDataOnce(), SearchEngineTest\fetchIds(), SearchEnginePrefixTest\setUp(), PrefixSearchTest\setUp(), and TitlePermissionTest\testQuickPermissions().

◆ listTables()

static MediaWikiTestCase::listTables ( IMaintainableDatabase  $db)
static
Since
1.18
Parameters
IMaintainableDatabase$db
Returns
array
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1345 of file MediaWikiTestCase.php.

References $db, and $tables.

Referenced by setupDatabaseWithTestPrefix().

◆ makeTestConfig()

static MediaWikiTestCase::makeTestConfig ( Config  $baseConfig = null,
Config  $customOverrides = null 
)
staticprivate

Create a config suitable for testing, based on a base config, default overrides, and custom overrides.

Parameters
Config | null$baseConfig
Config | null$customOverrides
Returns
Config
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 240 of file MediaWikiTestCase.php.

References CACHE_ACCEL, CACHE_DB, CACHE_MEMCACHED, CACHE_NONE, and false.

Referenced by overrideMwServices(), and resetGlobalServices().

◆ makeTestConfigFactoryInstantiator()

static MediaWikiTestCase::makeTestConfigFactoryInstantiator ( ConfigFactory  $oldFactory,
array  $configurations 
)
staticprivate
Parameters
ConfigFactory$oldFactory
Config[]$configurations
Returns
Closure
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 308 of file MediaWikiTestCase.php.

References $name, $services, as, ConfigFactory\getConfigNames(), ConfigFactory\makeConfig(), and use.

◆ markTestSkippedIfNoDiff3()

MediaWikiTestCase::markTestSkippedIfNoDiff3 ( )
protected

Check, if $wgDiff3 is set and ready to merge Will mark the calling test as skipped, if not ready.

Since
1.21
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1695 of file MediaWikiTestCase.php.

References global.

Referenced by EditPageTest\testAutoMerge(), GlobalTest\testMerge(), and WikitextContentHandlerTest\testMerge3().

◆ mergeMwGlobalArrayValue()

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.

Parameters
string$nameThe name of the global, as in wgFooBar
array$valuesThe array containing the entries to set in that global
Exceptions
MWExceptionIf the designated global is not an array.
Note
To allow changes to global variables to take effect on global service instances, call overrideMwServices().
Since
1.21
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 766 of file MediaWikiTestCase.php.

References $GLOBALS, $name, as, and setMwGlobals().

Referenced by TextPassDumperDatabaseTest\addDBData(), GenderCacheTest\addDBDataOnce(), MediaWiki\Auth\LegacyHookPreAuthenticationProviderTest\hook(), CaptchaPreAuthenticationProviderTest\setMwHook(), setTemporaryHook(), AutoLoaderTest\setUp(), PageLangLogFormatterTest\setUp(), RevisionTest\setUp(), NewUsersLogFormatterTest\setUp(), TitleMethodsTest\setUp(), ApiRevisionDeleteTest\setUp(), BotPasswordTest\setUp(), ApiOptionsTest\setUp(), SearchEngineTest\testAugmentorSearch(), TitleTest\testCreateFragmentTitle(), MediaWiki\Session\SessionBackendTest\testDelaySave(), SpecialMyLanguageTest\testFindTitle(), SpecialPageFactoryTest\testGetAliasListRecursion(), UserTest\testGetCanonicalName(), QuestyCaptchaTest\testGetCaptcha(), SpecialPageFactoryTest\testGetNames(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest\testGetNewPasswordExpiry(), SpecialPageFactoryTest\testGetPage(), SpecialPageFactoryTest\testHookNotCalledTwice(), ApiMainTest\testLacksSameOriginSecurity(), MediaWiki\Session\SessionManagerTest\testLoadSessionInfoFromStore(), MediaWiki\Session\CookieSessionProviderTest\testPersistSession(), MediaWiki\Session\CookieSessionProviderTest\testPersistSessionWithHook(), CaptchaPreAuthenticationProviderTest\testPingLimiter(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testProviderChangeAuthenticationData(), MediaWiki\Auth\AbstractPrimaryAuthenticationProviderTest\testProviderNormalizeUsername(), LocalisationCacheTest\testRecacheFallbacksWithHooks(), MediaWiki\Session\SessionBackendTest\testRenew(), MediaWiki\Session\SessionBackendTest\testSave(), MediaWiki\Session\PHPSessionHandlerTest\testSessionHandling(), MediaWiki\Auth\ThrottlePreAuthenticationProviderTest\testTestForAccountCreation(), UserTest\testUserGetRightsHooks(), and MediaWiki\Auth\LegacyHookPreAuthenticationProviderTest\unhook().

◆ needsDB()

MediaWikiTestCase::needsDB ( )
Returns
bool
Since
1.18
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 927 of file MediaWikiTestCase.php.

Referenced by assertSelect(), run(), setUp(), and tearDown().

◆ objectAssociativeSort()

MediaWikiTestCase::objectAssociativeSort ( array $array)
protected

Does an associative sort that works for objects.

Since
1.20
Parameters
array$array
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1543 of file MediaWikiTestCase.php.

References serialize().

Referenced by assertArrayEquals().

◆ oncePerClass()

MediaWikiTestCase::oncePerClass ( )
private
Returns
bool
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 412 of file MediaWikiTestCase.php.

References class.

Referenced by run().

◆ overrideMwServices()

MediaWikiTestCase::overrideMwServices ( Config  $configOverrides = null,
array  $services = [] 
)
protected

Stashes the global instance of MediaWikiServices, and installs a new one, allowing test cases to override settings and services.

The previous instance of MediaWikiServices will be restored on tearDown.

Since
1.27
Parameters
Config$configOverridesConfiguration overrides for the new MediaWikiServices instance.
callable[]$servicesAn associative array of services to re-define. Keys are service names, values are callables.
Returns
MediaWikiServices
Exceptions
MWException
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 798 of file MediaWikiTestCase.php.

References $name, $services, as, installTestServices(), makeTestConfig(), MediaWikiServices, and Hooks\run().

Referenced by setService(), InterwikiTest\setWgInterwikiCache(), ObjectCacheTest\testNewAnythingNoAccelNoDb(), ObjectCacheTest\testNewAnythingNothingNoDb(), and MediaWikiTestCaseTest\testOverrideMwServices().

◆ prepareServices()

static MediaWikiTestCase::prepareServices ( Config  $bootstrapConfig)
static

Prepare service configuration for unit testing.

This calls MediaWikiServices::resetGlobalInstance() to allow some critical services to be overridden for testing.

prepareServices() only needs to be called once, but should be called as early as possible, before any class has a chance to grab a reference to any of the global services instances that get discarded by prepareServices(). Only the first call has any effect, later calls are ignored.

Note
This is called by PHPUnitMaintClass::finalSetup.
See also
MediaWikiServices::resetGlobalInstance()
Parameters
Config$bootstrapConfigThe bootstrap config to use with the new MediaWikiServices. Only used for the first call to this method.
Returns
MediaWikiServices
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 193 of file MediaWikiTestCase.php.

References $services, and resetGlobalServices().

Referenced by PHPUnitMaintClass\execute(), and setUpBeforeClass().

◆ resetDB()

MediaWikiTestCase::resetDB (   $db,
  $tablesUsed 
)
private

Empty all tables so they can be repopulated for tests.

Parameters
Database$db,|nullDatabase to reset
array$tablesUsedTables to reset
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1254 of file MediaWikiTestCase.php.

References $db, $tablesUsed, addCoreDBData(), as, TestUserRegistry\clear(), and LinkCache\singleton().

Referenced by run().

◆ resetGlobalServices()

static MediaWikiTestCase::resetGlobalServices ( Config  $bootstrapConfig = null)
staticprotected

Reset global services, and install testing environment.

This is the testing equivalent of MediaWikiServices::resetGlobalInstance(). This should only be used to set up the testing environment, not when running unit tests. Use MediaWikiTestCase::overrideMwServices() for that.

See also
MediaWikiServices::resetGlobalInstance()
prepareServices()
MediaWikiTestCase::overrideMwServices()
Parameters
Config | null$bootstrapConfigThe bootstrap config to use with the new MediaWikiServices.
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 215 of file MediaWikiTestCase.php.

References $serviceLocator, installTestServices(), and makeTestConfig().

Referenced by prepareServices().

◆ restoreLoggers()

MediaWikiTestCase::restoreLoggers ( )
private

Restores loggers replaced by setLogger().

Since
1.27
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 892 of file MediaWikiTestCase.php.

References as.

Referenced by tearDown().

◆ run()

◆ setCliArg()

MediaWikiTestCase::setCliArg (   $offset,
  $value 
)
Since
1.18
Parameters
string$offset
mixed$value
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1402 of file MediaWikiTestCase.php.

References PHPUnitMaintClass\$additionalOptions, and $value.

◆ setContentLang()

◆ setLogger()

MediaWikiTestCase::setLogger (   $channel,
LoggerInterface  $logger 
)
protected

◆ setMwGlobals()

MediaWikiTestCase::setMwGlobals (   $pairs,
  $value = null 
)
protected
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 658 of file MediaWikiTestCase.php.

References $GLOBALS, $value, as, and stashMwGlobals().

Referenced by BackupDumperPageTest\addDBData(), SearchEngineTest\addDBDataOnce(), EditPageTest\assertEdit(), mergeMwGlobalArrayValue(), SearchEnginePrefixTest\searchProvision(), PrefixSearchTest\searchProvision(), TitleTest\secureAndSplitGlobals(), ObjectCacheTest\setCacheConfig(), setContentLang(), CaptchaPreAuthenticationProviderTest\setTriggers(), ImagePageTest\setUp(), MWGrantsTest\setUp(), MediaWikiTest\setUp(), PageLangLogFormatterTest\setUp(), ObjectCacheTest\setUp(), CaptchaAuthenticationRequestTest\setUp(), RCFeedIntegrationTest\setUp(), ResourceLoaderTest\setUp(), RevisionTest\setUp(), GitInfoTest\setUp(), MWTimestampTest\setUp(), TestSample\setUp(), GlobalTest\setUp(), TitleTest\setUp(), BitmapMetadataHandlerTest\setUp(), BitmapScalingTest\setUp(), XmlTest\setUp(), SvgTest\setUp(), FormatMetadataTest\setUp(), WfThumbIsStandardTest\setUp(), MWCryptHKDFTest\setUp(), LanguageConverterTest\setUp(), LocalisationCacheTest\setUp(), JpegTest\setUp(), WikiPageTestContentHandlerUseDB\setUp(), RevisionTestContentHandlerUseDB\setUp(), LocalFileTest\setUp(), ApiTestCaseUpload\setUp(), TemplateParserTest\setUp(), ApiQueryTest\setUp(), LinkFilterTest\setUp(), WikiMapTest\setUp(), ContentHandlerTest\setUp(), ImagePage404Test\setUp(), CaptchaPreAuthenticationProviderTest\setUp(), TextContentTest\setUp(), UploadFromUrlTest\setUp(), CssContentTest\setUp(), ExportTest\setUp(), SpecialPageTest\setUp(), ExifRotationTest\setUp(), ExifTest\setUp(), SpecialWatchlistTest\setUp(), ApiTestCase\setUp(), ExifBitmapTest\setUp(), ActionTest\setUp(), TiffTest\setUp(), EditPageTest\setUp(), MWNamespaceTest\setUp(), ExtraParserTest\setUp(), MediaWiki\Auth\UserDataAuthenticationRequestTest\setUp(), ApiEditPageTest\setUp(), AbstractChangesListSpecialPageTestCase\setUp(), UserTest\setUp(), BotPasswordTest\setUp(), SearchEngineTest\setUp(), CategoryMembershipChangeJobTest\setUp(), ApiQueryTitleBlacklistTest\setUp(), UserGroupMembershipTest\setUp(), TitlePermissionTest\setUp(), OldChangesListTest\setUp(), WfParseUrlTest\setUp(), SearchUpdateTest\setUp(), NaiveImportTitleFactoryTest\setUp(), NamespaceImportTitleFactoryTest\setUp(), SubpageImportTitleFactoryTest\setUp(), LinksUpdateTest\setUp(), MediaWikiTitleCodecTest\setUp(), RCCacheEntryFactoryTest\setUp(), MediaWiki\Auth\AuthManagerTest\setUp(), PreferencesTest\setUp(), MagicVariableTest\setUp(), SearchEnginePrefixTest\setUp(), PrefixSearchTest\setUp(), LogFormatterTest\setUp(), MediaWiki\Session\BotPasswordSessionProviderTest\setUp(), ResourceLoaderTestCase\setUp(), DumpTestCase\setUp(), RepoGroupTest\setUpForeignRepo(), setUserLang(), InterwikiTest\setWgInterwikiCache(), FileBackendTest\testAsyncWrites(), MediaWiki\Auth\AuthManagerTest\testAutoAccountCreation(), UserTest\testAutoblockCookieInauthentic(), UserTest\testAutoblockCookieInfiniteExpiry(), UserTest\testAutoblockCookieNoSecretKey(), UserTest\testAutoblockCookies(), UserTest\testAutoblockCookiesDisabled(), BotPasswordTest\testBasics(), ApiLoginTest\testBotPassword(), UploadStashTest\testBug29408(), SpecialPreferencesTest\testBug41337(), FileTest\testCanAnimateThumbIfAppropriate(), MediaWiki\Auth\AuthManagerTest\testCheckAccountCreatePermissions(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest\testCheckPasswordValidity(), UserTest\testCheckPasswordValidity(), ExtraParserTest\testCleanSigDisabled(), RevisionTest\testCompressRevisionTextUtf8Gzip(), SpecialPageFactoryTest\testConflictResolution(), MediaWiki\Auth\ThrottlerTest\testConstructor(), ResourceLoaderTest\testConstructRegistrationHook(), MediaWiki\Session\CookieSessionProviderTest\testCookieData(), EditPageTest\testCreatePage(), EditPageTest\testCreatePageTrx(), GlobalTest\testDebugFunctionTest(), WebRequestTest\testDetectServer(), ApiDocumentationTest\testDocumentationExists(), DeferredUpdatesTest\testDoUpdatesCLI(), DeferredUpdatesTest\testDoUpdatesWeb(), BadTitleErrorTest\testExceptionSetsStatusCode(), ThrottledErrorTest\testExceptionSetsStatusCode(), UserTest\testExperienceLevel(), ExtensionRegistryTest\testExportExtractedDataGlobals(), ExternalStoreTest\testExternalFetchFromURL(), SideBarTest\testExternalUrlsRequireADescription(), CentralIdLookupTest\testFactory(), ChangesListSpecialPageTest\testFilterUserExpLevel(), SpecialMyLanguageTest\testFindTitle(), RepoGroupTest\testForEachForeignRepoNone(), FileTest\testGenerateBucketsIfNeeded(), ContentHandlerTest\testGetAutosummary(), QuestyCaptchaTest\testGetCaptcha(), ContentHandlerTest\testGetContentText_NonTextContent_fail(), ContentHandlerTest\testGetContentText_NonTextContent_ignore(), ContentHandlerTest\testGetContentText_NonTextContent_serialize(), ContentHandlerTest\testGetContentText_Null(), ContentHandlerTest\testGetContentText_TextContent(), WebRequestTest\testGetIP(), WebRequestTest\testGetIpLackOfRemoteAddrThrowAnException(), ResourceLoaderTest\testGetLoadScript(), SpecialPageFactoryTest\testGetLocalNameFor(), ResourceLoaderStartUpModuleTest\testGetModuleRegistrations(), TitleTest\testGetPageViewLanguage(), DeferredUpdatesTest\testGetPendingUpdates(), HttpTest\testGetProxy(), CssContentTest\testGetRedirectTarget(), JavaScriptContentTest\testGetRedirectTarget(), WikiPageTest\testGetRedirectTarget(), MediaWiki\Session\ImmutableSessionProviderWithCookieTest\testGetSessionIdFromCookie(), FileTest\testGetThumbnailBucket(), SpecialPageFactoryTest\testGetTitleForAlias(), WikiMapTest\testGetWiki(), RepoGroupTest\testHasForeignRepoNegative(), RequestContextTest\testImportScopedSession(), ImportLogFormatterTest\testInterwikiLogDatabaseRows(), LocalIdLookupTest\testIsAttachedShared(), MWExceptionTest\testisCommandLine(), TextContentTest\testIsCountable(), WikiPageTest\testIsCountable(), RecentChangeTest\testIsInRCLifespan(), UserTest\testIsPingLimitable(), MergeHistoryTest\testIsValidMerge(), MovePageTest\testIsValidMove(), TitleTest\testIsValidMoveOperation(), MWExceptionTest\testJsonserializeexceptionBacktracingDisabled(), MWExceptionTest\testJsonserializeexceptionBacktracingEnabled(), MWExceptionTest\testJsonserializeexceptionKeys(), MediaWiki\Auth\UserDataAuthenticationRequestTest\testLoadFromSubmission(), BotPasswordTest\testLogin(), ResourceLoaderTest\testMakeLoaderImplementScript(), CssContentHandlerTest\testMakeRedirectContent(), JavaScriptContentHandlerTest\testMakeRedirectContent(), ExifRotationTest\testMetadataAutoRotate(), ExifRotationTest\testMetadataAutoRotateUnsupported(), ExifRotationTest\testMetadataNoAutoRotate(), BitmapMetadataHandlerTest\testMultilingualCascade(), ObjectCacheTest\testNewAnythingAccel(), ObjectCacheTest\testNewAnythingHash(), ObjectCacheTest\testNewAnythingNoAccel(), ObjectCacheTest\testNewAnythingNoAccelNoDb(), MailAddressTest\testNewFromUser(), MediaWikiSiteTest\testNormalizePageTitle(), RCFeedIntegrationTest\testNotify(), LinksUpdateTest\testOnAddingAndRemovingCategory_recentChangesRowIsAdded(), LinksUpdateTest\testOnAddingAndRemovingCategoryToTemplates_embeddingPagesAreIgnored(), MediaWiki\Session\ImmutableSessionProviderWithCookieTest\testPersistSession(), JpegPixelFormatTest\testPixelFormatRendering(), ResourceLoaderModuleTest\testPlaceholderize(), DeferredUpdatesTest\testPresendAddOnPostsendRun(), CdnCacheUpdateTest\testPurgeMergeWeb(), MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProviderTest\testRangeBlock(), GlobalTest\testReadOnlyGlobalChange(), ResourceLoaderStartUpModuleTest\testRegistrationsMinified(), ErrorPageErrorTest\testReport(), SpecialPageFactoryTest\testResolveAlias(), SideBarTest\testRespectExternallinktarget(), SideBarTest\testRespectWgnofollowlinks(), ExifRotationTest\testRotationRenderingNoAutoRotate(), MWExceptionTest\testRunHooks(), SpecialSearchTest\testSearchTermIsNotExpanded(), MediaWiki\Session\PHPSessionHandlerTest\testSessionHandling(), MediaWiki\Auth\AuthManagerTest\testSetDefaultUserOptions(), MediaWikiTestCaseTest\testSetGlobalsAreRestoredOnTearDown(), MediaWikiTestCaseTest\testSetNonExistentGlobalsAreUnsetOnTearDown(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testSetPasswordResetFlag(), MediaWiki\Logger\LegacyLoggerTest\testShouldEmit(), UserTest\testSoftBlockRanges(), SpecialSearchTest\testSubPageRedirect(), ExifBitmapTest\testSwappingICCProfile(), SideBarTest\testTestAttributesAssertionHelper(), CaptchaPreAuthenticationProviderTest\testTestForAuthentication(), ApiQueryTest\testTitlePartToKey(), ApiQueryTest\testTitlesGetNormalized(), MailAddressTest\testToString(), LinksUpdateTest\testUpdate_categorylinks(), LinksUpdateTest\testUpdate_langlinks(), LinksUpdateTest\testUpdate_page_props_without_sortkey(), EditPageTest\testUpdatePage(), EditPageTest\testUpdatePageTrx(), JavaScriptContentTest\testUpdateRedirect(), ApiUploadTest\testUploadChunks(), ApiUploadTest\testUploadStash(), MWExceptionTest\testUseMessageCache(), MWExceptionTest\testUseOutputPage(), TimeAdjustTest\testUserAdjust(), ResourceLoaderModuleTest\testValidateScriptFile(), WfExpandUrlTest\testWfExpandUrl(), TitleTest\testWgWhitelistReadRegexp(), AutoLoaderTest\testWrongCaseClass(), AutoLoaderTest\testWrongCaseSerializedClass(), and GlobalTest\wfWikiID().

◆ setService()

◆ setTemporaryHook()

MediaWikiTestCase::setTemporaryHook (   $hookName,
  $handler 
)
protected

Create a temporary hook handler which will be reset by tearDown.

This replaces other handlers for the same hook.

Parameters
string$hookNameHook name
mixed$handlerValue suitable for a hook handler
Since
1.28
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1796 of file MediaWikiTestCase.php.

References $handler, and mergeMwGlobalArrayValue().

Referenced by SpecialWatchlistTest\provideFetchOptionsFromRequest(), SpecialWatchlistTest\setUp(), ContentHandlerTest\testDataIndexFields(), ContentHandlerTest\testGetContentModelsHook(), and SearchEngineTest\testSearchIndexFields().

◆ setUp()

MediaWikiTestCase::setUp ( )
protected

Reimplemented in FetchTextTest, MaintenanceTest, DumpTestCase, TextPassDumperDatabaseTest, BackupDumperPageTest, ResourceLoaderTestCase, FileBackendTest, MediaWiki\Session\BotPasswordSessionProviderTest, LogFormatterTest, CategoryMembershipChangeTest, LanguageClassesTestCase, PrefixSearchTest, SearchEnginePrefixTest, ParserPreloadTest, PreprocessorTest, SideBarTest, DatabaseSqliteTest, FormOptionsInitializationTest, RevisionStorageTest, MagicVariableTest, WikiPageTest, PreferencesTest, MediaWiki\Auth\AuthManagerTest, PasswordTestCase, RCCacheEntryFactoryTest, MediaWiki\Logger\Monolog\LineFormatterTest, MediaWikiTitleCodecTest, LinksUpdateTest, FormOptionsTest, MediaWiki\Logger\Monolog\KafkaHandlerTest, FauxResponseTest, NaiveImportTitleFactoryTest, NamespaceImportTitleFactoryTest, SubpageImportTitleFactoryTest, MediaWiki\Logger\Monolog\AvroFormatterTest, SearchUpdateTest, WfParseUrlTest, OldChangesListTest, TestPageProps, TitlePermissionTest, ApiOptionsTest, ApiQueryWatchlistIntegrationTest, LinkRendererFactoryTest, UserGroupMembershipTest, ApiQueryTitleBlacklistTest, CategoryMembershipChangeJobTest, SearchEngineTest, DifferenceEngineTest, SwiftFileBackendTest, UploadStashTest, BotPasswordTest, InterwikiLookupAdapterTest, JobQueueTest, AbstractChangesListSpecialPageTestCase, ChangesListSpecialPageTest, SpecialPageTestBase, UserTest, DatabaseTest, ImportLinkCacheIntegrationTest, ApiEditPageTest, JpegMetadataExtractorTest, RESTBagOStuffTest, ApiRevisionDeleteTest, MediaWiki\Auth\UserDataAuthenticationRequestTest, ExtraParserTest, ArticleTest, PathRouterTest, ApiQueryWatchlistRawIntegrationTest, RecentChangeTest, EditPageTest, StoreBatchTest, MultiWriteBagOStuffTest, MediaWikiMediaTestCase, MWNamespaceTest, WatchedItemStoreIntegrationTest, ActionTest, ApiSetNotificationTimestampIntegrationTest, ApiTestCase, DatabaseSQLTest, BagOStuffTest, DjVuTest, ExifBitmapTest, TiffTest, SpecialRecentchangesTest, SpecialWatchlistTest, WatchedItemIntegrationTest, XmlSelectTest, ApiParseTest, ApiPurgeTest, CssContentTest, FileContentHandlerTest, WikitextContentHandlerTest, ExportTest, ExifRotationTest, ExifTest, JpegPixelFormatTest, SpecialPageTest, TitleMethodsTest, CaptchaPreAuthenticationProviderTest, ApiBlockTest, ApiUnblockTest, ChangesListFilterTest, CollationTest, TextContentTest, ReplicatedBagOStuffTest, GIFHandlerTest, PNGHandlerTest, XCFHandlerTest, ImagePage404Test, SpecialMIMESearchTest, UploadFromUrlTest, ApiQueryAllPagesTest, ApiTestCaseUpload, ApiWatchTest, ApiQueryTest, MessageCacheTest, ContentHandlerTest, LocalFileTest, LinkFilterTest, WikiPageTestContentHandlerUseDB, ResourceLoaderImageTest, RevisionTestContentHandlerUseDB, SiteConfigurationTest, TemplateParserTest, LocalIdLookupTest, WikiMapTest, ExpressionTest, LocalisationCacheTest, MigrateFileRepoLayoutTest, WfThumbIsStandardTest, JpegTest, PNGMetadataExtractorTest, MemcachedBagOStuffTest, ExtensionProcessorTest, ResourceLoaderFileModuleTest, MWCryptHKDFTest, WebRequestTest, LanguageConverterTest, TitleBlacklistPreAuthenticationProviderTest, GlobalTest, NewUsersLogFormatterTest, BitmapMetadataHandlerTest, BitmapScalingTest, FormatMetadataTest, SvgTest, TidyTest, TestSample, BalancerTest, TitleTest, XmlTest, CaptchaAuthenticationRequestTest, TitleBlacklistAuthenticationRequestTest, GitInfoTest, ComposerJsonTest, ComposerLockTest, MWTimestampTest, RCFeedIntegrationTest, ResourceLoaderTest, RevisionTest, MediaWikiLangTestCase, MWDebugTest, DiffHistoryBlobTest, HooksTest, PageLangLogFormatterTest, ObjectCacheTest, MediaWikiTest, ImagePageTest, TimeAdjustTest, MWGrantsTest, AutoLoaderTest, and WebPHandlerTest.

Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 473 of file MediaWikiTestCase.php.

References $lbFactory, as, DeferredUpdates\clearPendingUpdates(), ObjectCache\getMainWANInstance(), needsDB(), Maintenance\setLBFactoryTriggers(), and wfRecursiveRemoveDir().

◆ setupAllTestDBs()

MediaWikiTestCase::setupAllTestDBs ( )

Set up all test DBs.

Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1119 of file MediaWikiTestCase.php.

References $wgDBprefix, dbPrefix(), global, setupExternalStoreTestDBs(), and setupTestDB().

Referenced by run().

◆ setUpBeforeClass()

static MediaWikiTestCase::setUpBeforeClass ( )
static

◆ setupDatabaseWithTestPrefix()

static MediaWikiTestCase::setupDatabaseWithTestPrefix ( IMaintainableDatabase  $db,
  $prefix 
)
staticprotected

Setups a database with the given prefix.

If reuseDB is true and certain conditions apply, it will just change the prefix. Otherwise, it will clone the tables and change the prefix.

Clones all tables in the given database (whatever database that connection has open), to versions with the test prefix.

Parameters
IMaintainableDatabase$dbDatabase to use
string$prefixPrefix to use for test tables
Returns
bool True if tables were cloned, false if only the prefix was changed
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1101 of file MediaWikiTestCase.php.

References $db, $useTemporaryTables, CloneDatabase\changePrefix(), and listTables().

Referenced by setupExternalStoreTestDBs().

◆ setupExternalStoreTestDBs()

static MediaWikiTestCase::setupExternalStoreTestDBs (   $testPrefix)
staticprotected

Clones the External Store database(s) for testing.

Parameters
string$testPrefixPrefix for test tables
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1186 of file MediaWikiTestCase.php.

References as, getExternalStoreDatabaseConnections(), and setupDatabaseWithTestPrefix().

Referenced by setupAllTestDBs().

◆ setupTestDB()

static MediaWikiTestCase::setupTestDB ( Database  $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.

Since
1.21
Note
the original table prefix is stored in self::$oldTablePrefix. This is used by teardownTestDB() to return the wiki to using the original table set.
this method only works when first called. Subsequent calls have no effect, even if using different parameters.
Parameters
Database$dbThe database connection
string$prefixThe prefix to use for the new table set (aka schema).
Exceptions
MWExceptionIf the database table prefix is already $prefix
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1155 of file MediaWikiTestCase.php.

References $db.

Referenced by ParserTestTopLevelSuite\setUp(), and setupAllTestDBs().

◆ setUserLang()

◆ stashMwGlobals()

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

Parameters
array | string$globalKeysKey to the global variable, or an array of keys.
Note
To allow changes to global variables to take effect on global service instances, call overrideMwServices().
Since
1.23
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 710 of file MediaWikiTestCase.php.

References $e, $GLOBALS, as, serialize(), and unserialize().

Referenced by GlobalVarConfigTest\maybeStashGlobal(), setMwGlobals(), LocalIdLookupTest\setUp(), MediaWiki\Auth\AuthManagerTest\setUp(), MediaWiki\Auth\AuthManagerTest\testAutoAccountCreation(), MediaWiki\Auth\AuthManagerTest\testCheckAccountCreatePermissions(), MediaWiki\Auth\TemporaryPasswordAuthenticationRequestTest\testNewRandom(), MediaWikiTestCaseTest\testStashedGlobalsAreRestoredOnTearDown(), and ApiQueryTitleBlacklistTest\testTboverride().

◆ stripStringKeys()

static MediaWikiTestCase::stripStringKeys ( $r)
staticprotected

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.

Since
1.20
Parameters
mixed$rThe array to remove string keys from.
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1561 of file MediaWikiTestCase.php.

References as.

Referenced by assertSelect().

◆ tearDown()

MediaWikiTestCase::tearDown ( )
protected

Reimplemented in GadgetsTest, MaintenanceTest, MigrateFileRepoLayoutTest, TestPageProps, PrefixSearchTest, LanguageClassesTestCase, SearchEnginePrefixTest, RevisionStorageTest, ParserPreloadTest, StoreBatchTest, JobQueueTest, RevisionTest, ApiEditPageTest, ContentHandlerTest, WikiPageTest, UploadStashTest, SearchEngineTest, TextContentTest, TitleMethodsTest, CaptchaPreAuthenticationProviderTest, ApiTestCase, ApiQueryTitleBlacklistTest, AbstractChangesListSpecialPageTestCase, SpecialPageFactoryTest, LanguageConverterTest, TestSample, SpecialPageTestBase, DatabaseTest, ArticleTest, BaseDumpTest, XmlSelectTest, ApiBlockTest, WebRequestTest, and WebPHandlerTest.

Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 514 of file MediaWikiTestCase.php.

References $GLOBALS, $phpErrorLevel, $status, $value, $wgRequest, $wgSQLMode, as, global, needsDB(), MediaWiki\Session\SessionManager\resetCache(), MediaWiki\Auth\AuthManager\resetCache(), RequestContext\resetMain(), restoreLoggers(), and wfRecursiveRemoveDir().

Referenced by MediaWikiTestCaseTest\testLoggersAreRestoredOnTearDown_replacingExistingLogger(), MediaWikiTestCaseTest\testLoggersAreRestoredOnTearDown_replacingNonExistingLogger(), MediaWikiTestCaseTest\testLoggersAreRestoredOnTearDown_replacingSameLoggerTwice(), MediaWikiTestCaseTest\testOverrideMwServices(), MediaWikiTestCaseTest\testSetGlobalsAreRestoredOnTearDown(), MediaWikiTestCaseTest\testSetNonExistentGlobalsAreUnsetOnTearDown(), MediaWikiTestCaseTest\testSetService(), and MediaWikiTestCaseTest\testStashedGlobalsAreRestoredOnTearDown().

◆ teardownTestDB()

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

Since
1.21
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1070 of file MediaWikiTestCase.php.

References $type, as, CloneDatabase\changePrefix(), global, and JobQueueGroup\singleton().

Referenced by MediaWikiPHPUnitBootstrap\__destruct().

◆ testMediaWikiTestCaseParentSetupCalled()

MediaWikiTestCase::testMediaWikiTestCaseParentSetupCalled ( )
final

Make sure MediaWikiTestCase extending classes have called their parent setUp method.

With strict coverage activated in PHP_CodeCoverage, this test would be marked as risky without the following annotation (T152923). @coversNothing

Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 593 of file MediaWikiTestCase.php.

References class.

◆ unprefixTable()

static MediaWikiTestCase::unprefixTable ( $tableName,
  $ind,
  $prefix 
)
staticprivate

◆ usesTemporaryTables()

MediaWikiTestCase::usesTemporaryTables ( )
Since
1.21
Returns
bool
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 430 of file MediaWikiTestCase.php.

References $useTemporaryTables.

◆ wfResetOutputBuffersBarrier()

static MediaWikiTestCase::wfResetOutputBuffersBarrier (   $buffer)
static

Used as a marker to prevent wfResetOutputBuffers from breaking PHPUnit.

Returns
string
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 1785 of file MediaWikiTestCase.php.

References $buffer.

Member Data Documentation

◆ $called

MediaWikiTestCase::$called = []
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.

Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 36 of file MediaWikiTestCase.php.

Referenced by SpecialPageFactoryTest\testGetAliasListRecursion(), MediaWiki\Session\SessionManagerTest\testLoadSessionInfoFromStore(), DatabaseTest\testTransactionIdle(), DatabaseTest\testTransactionListener(), DatabaseTest\testTransactionResolution(), and HtmlCheckMatrixTest\testValidateCallsUserDefinedValidationCallback().

◆ $db

◆ $dbSetup

MediaWikiTestCase::$dbSetup = false
staticprivate

◆ $loggers

LoggerInterface [] MediaWikiTestCase::$loggers = []
private

Holds original loggers which have been replaced by setLogger()

Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 97 of file MediaWikiTestCase.php.

◆ $mwGlobals

array MediaWikiTestCase::$mwGlobals = []
private

Holds original values of MediaWiki configuration settings to be restored in tearDown().

See also setMwGlobals().

Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 84 of file MediaWikiTestCase.php.

◆ $mwGlobalsToUnset

array MediaWikiTestCase::$mwGlobalsToUnset = []
private

Holds list of MediaWiki configuration settings to be unset in tearDown().

See also setMwGlobals().

Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 91 of file MediaWikiTestCase.php.

◆ $oldTablePrefix

MediaWikiTestCase::$oldTablePrefix = ''
staticprivate

◆ $phpErrorLevel

int MediaWikiTestCase::$phpErrorLevel
private

Original value of PHP's error_reporting setting.

Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 68 of file MediaWikiTestCase.php.

Referenced by tearDown().

◆ $reuseDB

MediaWikiTestCase::$reuseDB = false
staticprivate

◆ $serviceLocator

MediaWikiServices null MediaWikiTestCase::$serviceLocator = null
staticprivate

The service locator created by prepareServices().

This service locator will be restored after each test. Tests that pollute the global service locator instance should use overrideMwServices() to isolate the test.

Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 22 of file MediaWikiTestCase.php.

Referenced by resetGlobalServices().

◆ $supportedDBs

array MediaWikiTestCase::$supportedDBs
protected
Initial value:
= [
'mysql',
'sqlite',
'postgres',
'oracle'
]
Since
1.18
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 109 of file MediaWikiTestCase.php.

Referenced by checkDbIsSupported().

◆ $tablesUsed

array MediaWikiTestCase::$tablesUsed = []
protected
Since
1.19
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 56 of file MediaWikiTestCase.php.

Referenced by resetDB().

◆ $tmpFiles

array MediaWikiTestCase::$tmpFiles = []
private

Holds the paths of temporary files/directories created through getNewTempFile, and getNewTempDirectory.

Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 76 of file MediaWikiTestCase.php.

Referenced by FileBackendTest\doTestGetLocalCopy(), and FileBackendTest\doTestGetLocalReference().

◆ $users

TestUser [] MediaWikiTestCase::$users
static
Since
1.20
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 42 of file MediaWikiTestCase.php.

Referenced by UserTest\testFindUsersByGroup().

◆ $useTemporaryTables

MediaWikiTestCase::$useTemporaryTables = true
staticprivate

◆ DB_PREFIX

const MediaWikiTestCase::DB_PREFIX = 'unittest_'

Table name prefixes.

Oracle likes it shorter.

Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 102 of file MediaWikiTestCase.php.

Referenced by TestUser\assertNotReal(), dbPrefix(), and ParserTestTopLevelSuite\setUp().

◆ ORA_DB_PREFIX

const MediaWikiTestCase::ORA_DB_PREFIX = 'ut_'

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