MediaWiki  master
MediaWikiTestCase Class Reference

Inherits TestCase.

Inherited by AbstractChangesListSpecialPageTestCase, ActionTest, ApiContinuationManagerTest, ApiFormatTestBase, ApiMessageTest, ApiModuleManagerTest, ApiOpenSearchTest, ApiPrefixUniquenessTest, ApiResultTest, ApiStructureTest, ApiUsageExceptionTest, ArrayDiffFormatterTest, ArticleTest, ArticleViewTest, AutoLoaderStructureTest, AutoLoaderTest, AutopromoteTest, BadTitleErrorTest, BagOStuffTest, BatchRowUpdateTest, BitmapMetadataHandlerTest, BitmapScalingTest, BotPasswordTest, CachingSiteStoreTest, CategoryMembershipChangeJobTest, CdnCacheUpdateTest, CentralIdLookupTest, ChangesListBooleanFilterGroupTest, ChangesListBooleanFilterTest, ChangesListFilterGroupTest, ChangesListFilterTest, ChangesListStringOptionsFilterGroupTest, ChangeTagsTest, ClassicInterwikiLookupTest, ClearUserWatchlistJobTest, ComposerInstalledTest, ComposerJsonTest, ComposerLockTest, ConfigFactoryTest, ContentHandlerSanityTest, ContentHandlerTest, ContentSecurityPolicyTest, ContribsPagerTest, CoreParserFunctionsTest, CSSMinTest, CustomUppercaseCollationTest, DatabaseIntegrationTest, DatabaseLogEntryTest, DatabasePostgresTest, DatabaseSqliteTest, DBSiteStoreTest, DefaultPreferencesFactoryTest, DeferredUpdatesTest, DeprecatedGlobalTest, DeprecationHelperTest, DifferenceEngineTest, DiffHistoryBlobTest, DiffOpTest, DiffTest, DummyExtensionsTest, ErrorPageErrorTest, ExifTest, ExtensionJsonValidatorTest, ExtensionProcessorTest, ExtensionRegistryTest, ExternalStoreTest, ExternalUserNamesTest, ExtraParserTest, FauxResponseTest, FileBackendDBRepoWrapperTest, FileBackendTest, FileRepoTest, FiltersTest, ForeignTitleTest, FormatJsonTest, FormOptionsInitializationTest, FormOptionsTest, GIFMetadataExtractorTest, GitInfoTest, GlobalTest, GlobalVarConfigTest, GlobalWithDBTest, HashConfigTest, HashSiteStoreTest, HooksTest, HTMLAutoCompleteSelectFieldTest, HTMLCheckMatrixTest, HTMLFormTest, HtmlTest, HttpErrorTest, HttpTest, ImageListPagerTest, ImportLinkCacheIntegrationTest, InstallDocFormatterTest, InterwikiLookupAdapterTest, InterwikiTest, IPTCTest, JobQueueTest, JobTest, JpegMetadataExtractorTest, JsonContentHandlerTest, LanguageClassesTestCase, LBFactoryTest, LicensesTest, ListToggleTest, LoadBalancerTest, LocalFileTest, LocalIdLookupTest, LocalisationCacheTest, MagicVariableTest, MailAddressTest, 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, MediaWiki\Tests\EditPage\TextboxBuilderTest, MediaWiki\Tests\Maintenance\BaseDumpTest, MediaWiki\Tests\Maintenance\FetchTextTest, MediaWiki\Tests\Maintenance\MaintenanceBaseTestCase, MediaWiki\Tests\Revision\MutableRevisionRecordTest, MediaWiki\Tests\Revision\RenderedRevisionTest, MediaWiki\Tests\Revision\RevisionArchiveRecordTest, MediaWiki\Tests\Revision\RevisionQueryInfoTest, MediaWiki\Tests\Revision\RevisionRendererTest, MediaWiki\Tests\Revision\RevisionSlotsTest, MediaWiki\Tests\Revision\RevisionStoreDbTestBase, MediaWiki\Tests\Revision\RevisionStoreFactoryTest, MediaWiki\Tests\Revision\RevisionStoreRecordTest, MediaWiki\Tests\Revision\RevisionStoreTest, MediaWiki\Tests\Revision\SlotRecordTest, MediaWiki\Tests\Storage\BlobStoreFactoryTest, MediaWiki\Tests\Storage\DerivedPageDataUpdaterTest, MediaWiki\Tests\Storage\NameTableStoreFactoryTest, MediaWiki\Tests\Storage\NameTableStoreTest, MediaWiki\Tests\Storage\PageUpdaterTest, MediaWiki\Tests\Storage\RevisionSlotsUpdateTest, MediaWiki\Tests\Storage\SqlBlobStoreTest, MediaWikiLangTestCase, MediaWikiMediaTestCase, MediaWikiServicesTest, MediaWikiTest, MediaWikiTestCaseSchema1Test, MediaWikiTestCaseSchema2Test, MediaWikiTestCaseTest, MediaWikiTitleCodecTest, MediaWikiVersionFetcherTest, MemcachedBagOStuffTest, MergeHistoryTest, MigrateFileRepoLayoutTest, MovePageTest, MultiConfigTest, MultiHttpClientTest, MultiWriteBagOStuffTest, MWCryptHKDFTest, MWDebugTest, MWExceptionHandlerTest, MWExceptionTest, MWGrantsTest, MWNamespaceTest, NaiveForeignTitleFactoryTest, NaiveImportTitleFactoryTest, NamespaceAwareForeignTitleFactoryTest, NamespaceImportTitleFactoryTest, NoWriteWatchedItemStoreUnitTest, ObjectCacheTest, OracleInstallerTest, OutputPageTest, PageArchiveTestBase, PageDataRequestHandlerTest, ParserFactoryTest, ParserOptionsTest, ParserPreloadTest, PasswordFactoryTest, PasswordPolicyChecksTest, PasswordResetTest, PasswordTest, PasswordTestCase, PathRouterTest, PNGMetadataExtractorTest, PoolCounterTest, PoolWorkArticleViewTest, PreferencesTest, PreprocessorTest, QueryAllSpecialPagesTest, RCFeedIntegrationTest, ReadOnlyErrorTest, ReadOnlyModeTest, RecentChangeTest, RefreshLinksJobTest, RefreshLinksPartitionTest, ReleaseNotesTest, RemexDriverTest, ReplicatedBagOStuffTest, RepoGroupTest, RequestContextTest, ResourceLoaderSkinModuleTest, ResourceLoaderTestCase, ResourcesTest, RESTBagOStuffTest, RevisionDbTestBase, RevisionTest, SanitizerTest, SearchIndexFieldTest, SearchResultSetTest, SearchUpdateTest, ServiceWiringTest, ShellTest, SiteConfigurationTest, SiteListTest, SiteStatsTest, SiteStatsUpdateTest, SiteTest, SkinFactoryTest, SkinTemplateTest, SkinTest, SpecialMIMESearchTest, SpecialMyLanguageTest, SpecialPageAliasTest, SpecialPageFactoryTest, SpecialPageFatalTest, SpecialPageTest, SpecialPageTestBase, SpecialPreferencesTest, SpecialRedirectTest, SpecialSearchTest, SpecialShortpagesTest, SpecialUploadTest, StoreBatchTest, StripStateTest, StructureTest, SubpageImportTitleFactoryTest, SVGMetadataExtractorTest, SwiftFileBackendTest, TagHooksTest, TemplateParserTest, TextSlotDiffRendererTest, ThrottledErrorTest, TidyTest, TiffTest, TitleTest, TitleValueTest, UncategorizedCategoriesPageTest, UploadBaseTest, UploadStashTest, UserArrayFromResultTest, UserGroupMembershipTest, UserNotLoggedInTest, UserPasswordPolicyTest, UserTest, WatchActionTest, WatchedItemQueryServiceUnitTest, WatchedItemStoreIntegrationTest, WatchedItemStoreUnitTest, WebPHandlerTest, WebRequestTest, WfAppendQueryTest, WfArrayFilterTest, WfArrayPlus2dTest, WfAssembleUrlTest, WfBaseNameTest, WfEscapeShellArgTest, WfExpandUrlTest, WfGetCallerTest, WfParseUrlTest, WfRemoveDotSegmentsTest, WfShellExecTest, WfShorthandToIntegerTest, WfStringToBoolTest, WfThumbIsStandardTest, WfTimestampTest, WfUrlencodeTest, XmlSelectTest, and XmlTest.

Collaboration diagram for MediaWikiTestCase:

Public Member Functions

 __construct ( $name=null, array $data=[], $dataName='')
 
 __destruct ()
 
 addDBData ()
 Stub. More...
 
 addDBDataOnce ()
 Stub. More...
 
 copyTestData (IDatabase $source, IDatabase $target)
 Copy test data from one database connection to another. 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)
 
 setGroupPermissions ( $newPerms, $newKey=null, $newValue=null)
 Alters $wgGroupPermissions for the duration of the test. More...
 
 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 getTestPrefixFor (IDatabase $db)
 
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 installMockMwServices (Config $configOverrides=null)
 Creates a new "mock" MediaWikiServices instance, and installs it. More...
 
static listTables (IMaintainableDatabase $db)
 
static prepareServices (Config $bootstrapConfig)
 
static resetNonServiceCaches ()
 Resets some non-service singleton instances and other static caches. More...
 
static restoreMwServices ()
 Restores the original, non-mock MediaWikiServices instance. 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

 addCoreDBData ()
 
 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...
 
 assertFileContains ( $fileName, $actualData, $createIfMissing=false, $msg='')
 Check whether file contains given data. 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, array $options=[], array $join_conds=[])
 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...
 
 checkDbIsSupported ()
 
 checkPHPExtension ( $extName)
 Check if $extName is a loaded PHP extension, will skip the test whenever it is not loaded. More...
 
 editPage ( $pageName, $text, $summary='', $defaultNs=NS_MAIN)
 Edits or creates a page/revision. More...
 
 ensureMockDatabaseConnection (IDatabase $db)
 
 getDefaultWikitextNS ()
 Returns the ID of a namespace that defaults to Wikitext. More...
 
 getExistingTestPage ( $title=null)
 Returns a WikiPage representing an existing page. More...
 
 getNewTempDirectory ()
 obtains a new temporary directory More...
 
 getNewTempFile ()
 Obtains a new temporary file name. More...
 
 getNonexistingTestPage ( $title=null)
 Returns a WikiPage representing a non-existing page. More...
 
static getSchemaOverrides (IMaintainableDatabase $db)
 Stub. More...
 
 insertPage ( $pageName, $text='Sample page for unit test.', $namespace=null, User $user=null)
 Insert a new page. More...
 
 isTestInDatabaseGroup ()
 
 isWikitextNS ( $ns)
 Returns true if the given namespace defaults to Wikitext according to $wgNamespaceContentModels. More...
 
 markTestSkippedIfDbType ( $type)
 Skip the test if using the specified database type. 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...
 
 revisionDelete ( $rev, array $value=[Revision::DELETED_TEXT=> 1], $comment='')
 Revision-deletes a revision. More...
 
 setIniSetting ( $name, $value)
 Set an ini setting for the duration of the test. More...
 
 setLogger ( $channel, LoggerInterface $logger)
 Sets the logger for a specified channel, for the duration of the test. More...
 
 setMwGlobals ( $pairs, $value=null)
 Sets a global, maintaining a stashed version of the previous global to be restored in tearDown. More...
 
 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 ()
 
 truncateTable ( $tableName, IDatabase $db=null)
 Empties the given table and resets any auto-increment counters. More...
 

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 setupDatabaseWithTestPrefix (IMaintainableDatabase $db, $prefix=null)
 Setups a database with cloned tables using the given prefix. More...
 
static setupExternalStoreTestDBs ( $testPrefix=null)
 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

 containsClosure ( $var, $maxDepth=15)
 
 doSetMwGlobals ( $pairs, $value=null)
 An internal method that allows setService() to set globals that tests are not supposed to touch. More...
 
 doStashMwGlobals ( $globalKeys)
 
 dropMockTables (IMaintainableDatabase $db, array $tables)
 Drops the given mock tables. More...
 
 listOriginalTables (IMaintainableDatabase $db, $prefix='prefixed')
 Lists all tables in the live database schema. More...
 
 mungeSchemaUpdateQuery ( $cmd)
 
 oncePerClass ()
 
 recloneMockTables (IMaintainableDatabase $db, array $tables)
 Re-clones the given mock tables to restore them based on the live database schema. More...
 
 resetDB ( $db, $tablesUsed)
 Empty all tables so they can be repopulated for tests. More...
 
 resetNamespaces ()
 Must be called whenever namespaces are changed, e.g., $wgExtraNamespaces is altered. More...
 
 restoreLoggers ()
 Restores loggers replaced by setLogger(). More...
 
 setUpSchema (IMaintainableDatabase $db)
 Applies the schema overrides returned by getSchemaOverrides(), after undoing any previously applied schema overrides. More...
 
 undoSchemaOverrides (IMaintainableDatabase $db, $oldOverrides)
 Undoes the specified schema overrides. More...
 

Static Private Member Functions

static canShallowCopy ( $value)
 Check if we can back up a value by performing a shallow copy. More...
 
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...
 
array $cliArgs = []
 The CLI arguments passed through from phpunit.php. More...
 
array $iniSettings = []
 Holds original values of ini settings to be restored in tearDown(). More...
 
MediaWikiServices $localServices
 The local service locator, created during setUp(). 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...
 
string [] $overriddenServices = []
 Holds a list of services that were overridden with setService(). 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 MediaWikiServices null $originalServices
 The original service locator. More...
 
static $reuseDB = false
 
static $schemaOverrideDefaults
 
static $useTemporaryTables = true
 

Detailed Description

Since
1.18

Definition at line 16 of file MediaWikiTestCase.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 147 of file MediaWikiTestCase.php.

References $name.

◆ __destruct()

MediaWikiTestCase::__destruct ( )

Definition at line 154 of file MediaWikiTestCase.php.

References class.

Member Function Documentation

◆ addCoreDBData()

MediaWikiTestCase::addCoreDBData ( )
protected

◆ 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

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

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

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

Definition at line 2036 of file MediaWikiTestCase.php.

References objectAssociativeSort().

Referenced by MediaWiki\Tests\Revision\RevisionStoreDbTestBase\assertRevisionRecordsEqual(), BotPasswordTest\testCanonicalizeLoginData(), ResourcesTest\testCommentedLocalFileReferences(), SpecialWatchlistTest\testFetchOptionsFromRequest(), ChangesListSpecialPageTest\testFilterUserExpLevel(), WikiMapTest\testGetCanonicalServerInfoForAllWikis(), RangeChronologicalPagerTest\testGetDateRangeCond(), SiteListTest\testGetGlobalIdentifiers(), ApiModuleManagerTest\testGetGroups(), DjVuTest\testGetImageSize(), ComposerInstalledTest\testGetInstalledDependencies(), ComposerLockTest\testGetInstalledDependencies(), ChangesListBooleanFilterTest\testGetJsData(), ChangesListBooleanFilterGroupTest\testGetJsData(), ChangesListStringOptionsFilterGroupTest\testGetJsData(), ApiModuleManagerTest\testGetNames(), ApiModuleManagerTest\testGetNamesWithClasses(), DjVuTest\testGetPageDimensions(), TextContentTest\testGetParserOutput(), UserPasswordPolicyTest\testGetPoliciesForGroups(), UserPasswordPolicyTest\testGetPoliciesForUser(), ComposerJsonTest\testGetRequiredDependencies(), MediaWiki\Tests\Revision\RevisionSlotsTest\testGetRolesWithDifferentContent(), ChangesListSpecialPageTest\testGetStructuredFilterJsData(), MediaWiki\Session\CookieSessionProviderTest\testGetVaryCookies(), WikitextStructureTest\testHeadingsNone(), UserPasswordPolicyTest\testMaxOfPolicies(), ChangeTagsTest\testModifyDisplayQuery(), MediaWiki\Tests\Storage\RevisionSlotsUpdateTest\testModifySlot(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewNullRevision(), StatusTest\testOkAndErrorsGetters(), AbstractChangesListSpecialPageTestCase\testParseParameters(), SiteListTest\testSerialization(), ChangesListFilterTest\testSetAsSupersetOf(), CategoryChangesRdfTest\testSparqlUpdate(), LinksUpdateTest\testUpdate_pagelinks(), and AbstractChangesListSpecialPageTestCase\testValidateOptions().

◆ assertFileContains()

MediaWikiTestCase::assertFileContains (   $fileName,
  $actualData,
  $createIfMissing = false,
  $msg = '' 
)
protected

Check whether file contains given data.

Parameters
string$fileName
string$actualData
bool$createIfMissingIf true, and file does not exist, create it with given data and skip the test.
string$msg
Since
1.30

Definition at line 2304 of file MediaWikiTestCase.php.

Referenced by MediaWiki\Tests\Maintenance\CategoriesRdfTest\testCategoriesDump(), CategoryChangesRdfTest\testSparqlUpdate(), and CategoryChangesRdfTest\testUpdateTs().

◆ 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

Definition at line 2067 of file MediaWikiTestCase.php.

◆ assertSelect()

MediaWikiTestCase::assertSelect (   $table,
  $fields,
  $condition,
array  $expectedRows,
array  $options = [],
array  $join_conds = [] 
)
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.
array$optionsOptions for the query
array$join_condsJoin conditions for the query
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.

Definition at line 1966 of file MediaWikiTestCase.php.

References $options, $res, as, DB_REPLICA, Wikimedia\Rdbms\IDatabase\lastError(), needsDB(), Wikimedia\Rdbms\Database\select(), wfGetCaller(), and wfGetDB().

Referenced by LinksUpdateTest\assertLinksUpdate(), LinksUpdateTest\assertRecentChangeByCategorization(), MediaWiki\Tests\Revision\McrReadNewRevisionStoreDbTest\assertRevisionExistsInDatabase(), MediaWiki\Tests\Revision\McrRevisionStoreDbTest\assertRevisionExistsInDatabase(), MediaWiki\Tests\Revision\PreMcrRevisionStoreDbTest\assertRevisionExistsInDatabase(), MediaWiki\Tests\Revision\McrWriteBothRevisionStoreDbTest\assertRevisionExistsInDatabase(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\assertRevisionExistsInDatabase(), WikiPageDbTestBase\testDoDeleteArticleReal_suppress(), WikiPageDbTestBase\testDoDeleteArticleReal_user0(), WikiPageDbTestBase\testDoDeleteArticleReal_userSysop(), WikiPageDbTestBase\testDoEditContent(), RevisionDbTestBase\testInsertOn_success(), PageArchiveMcrTest\testListRevisions_slots(), RefreshLinksJobTest\testRunForSinglePage(), and MediaWiki\Tests\Storage\PageUpdaterTest\testSetUsePageCreationLog().

◆ assertType()

◆ 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

Definition at line 2124 of file MediaWikiTestCase.php.

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

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

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

Definition at line 780 of file MediaWikiTestCase.php.

References $value, and as.

◆ checkDbIsSupported()

MediaWikiTestCase::checkDbIsSupported ( )
protected
Exceptions
MWException
Since
1.18

Definition at line 1909 of file MediaWikiTestCase.php.

References $supportedDBs.

Referenced by run().

◆ checkPHPExtension()

◆ containsClosure()

MediaWikiTestCase::containsClosure (   $var,
  $maxDepth = 15 
)
private
Parameters
mixed$var
int$maxDepth
Returns
bool

Definition at line 870 of file MediaWikiTestCase.php.

References $value, and as.

Referenced by doStashMwGlobals().

◆ copyTestData()

MediaWikiTestCase::copyTestData ( IDatabase  $source,
IDatabase  $target 
)

Copy test data from one database connection to another.

This should only be used for small data sets.

Parameters
IDatabase$source
IDatabase$target

Definition at line 1890 of file MediaWikiTestCase.php.

References $res, $tables, array(), as, Wikimedia\Rdbms\IDatabase\insert(), and Wikimedia\Rdbms\IDatabase\select().

◆ dbPrefix()

◆ doSetMwGlobals()

MediaWikiTestCase::doSetMwGlobals (   $pairs,
  $value = null 
)
private

An internal method that allows setService() to set globals that tests are not supposed to touch.

Definition at line 724 of file MediaWikiTestCase.php.

References $GLOBALS, $value, as, doStashMwGlobals(), and resetNamespaces().

Referenced by setContentLang(), setMwGlobals(), and setService().

◆ doStashMwGlobals()

MediaWikiTestCase::doStashMwGlobals (   $globalKeys)
private

Definition at line 818 of file MediaWikiTestCase.php.

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

Referenced by doSetMwGlobals(), and stashMwGlobals().

◆ dropMockTables()

MediaWikiTestCase::dropMockTables ( IMaintainableDatabase  $db,
array  $tables 
)
private

Drops the given mock tables.

Parameters
IMaintainableDatabase$db
array$tables

Definition at line 1693 of file MediaWikiTestCase.php.

References as, ensureMockDatabaseConnection(), Wikimedia\Rdbms\IDatabase\query(), and Wikimedia\Rdbms\IMaintainableDatabase\tableName().

Referenced by setUpSchema(), and undoSchemaOverrides().

◆ editPage()

MediaWikiTestCase::editPage (   $pageName,
  $text,
  $summary = '',
  $defaultNs = NS_MAIN 
)
protected

Edits or creates a page/revision.

Parameters
string$pageNamePage title
string$textContent of the page
string$summaryOptional summary string for the revision
int$defaultNsOptional namespace id
Returns
array Array as returned by WikiPage::doEditContent()
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.

Definition at line 2333 of file MediaWikiTestCase.php.

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

Referenced by ApiParseTest\addDBDataOnce(), ApiQueryContinue2Test\addDBDataOnce(), ApiQueryBasicTest\addDBDataOnce(), ApiQueryContinueTest\addDBDataOnce(), ApiMoveTest\createPage(), ApiQueryPrefixSearchTest\setUp(), OutputPageTest\testAddBacklinkSubtitle(), ApiEditPageTest\testAppendNewSection(), ApiEditPageTest\testAppendNewSectionWithInvalidContentModel(), ApiEditPageTest\testAppendNewSectionWithSummary(), ApiEditPageTest\testAppendNewSectionWithTitle(), ApiEditPageTest\testAppendNewSectionWithTitleAndSummary(), ApiEditPageTest\testAppendToFirstSection(), ApiEditPageTest\testAppendToNonexistentSection(), ApiEditPageTest\testAppendToSection(), OutputPageTest\testBuildBacklinkSubtitle(), ApiParseTest\testCategoriesHtml(), ApiStashEditTest\testCheckCacheInterveningEdits(), ApiEditPageTest\testCreateOnly(), ApiDeleteTest\testDelete(), ApiDeleteTest\testDeleteAbortedByHook(), ApiStashEditTest\testDeletedRevision(), ApiStashEditTest\testDeletedRevisionSection(), ApiDeleteTest\testDeleteUnwatch(), ApiDeleteTest\testDeleteWatch(), ApiDeleteTest\testDeleteWithoutTagPermission(), ApiDeleteTest\testDeleteWithTag(), ApiDeleteTest\testDeleteWithTagNewBackend(), ApiDeleteTest\testDeletionWithoutPermission(), ApiStashEditTest\testEditConflict(), ApiEditPageTest\testEditMalformedSection(), ApiEditPageTest\testEditMinor(), ApiEditPageTest\testEditRecreate(), ApiEditPageTest\testEditWithStartTimestamp(), ApiStashEditTest\testExistingPage(), ApiParseTest\testFollowedRedirect(), ApiParseTest\testFollowedRedirectById(), ApiParseTest\testFormatCategories(), ApiQueryBasicTest\testGeneratorRedirects(), ApiStashEditTest\testInterveningEdit(), ApiQuerySiteinfoTest\testInterwikiMap(), ApiEditPageTest\testMd5AppendText(), ApiEditPageTest\testMd5PrependAndAppendText(), ApiEditPageTest\testMd5PrependText(), ApiStashEditTest\testNonexistentBaseRevId(), ApiParseTest\testNoPst(), ApiParseTest\testOnlyPst(), ApiStashEditTest\testPageWithNoRevisions(), ApiParseTest\testPst(), ApiEditPageTest\testReversedUndoAfter(), ApiParseTest\testSection(), ApiParseTest\testSectionNoContent(), ApiEditPageTest\testUndoAfterToHiddenRev(), ApiEditPageTest\testUndoAfterToInvalidRev(), ApiEditPageTest\testUndoAfterToRevFromDifferentPage(), ApiEditPageTest\testUndoToInvalidRev(), ApiEditPageTest\testUndoToRevFromDifferentPage(), ApiEditPageTest\testUndoWithConflicts(), ApiEditPageTest\testUndoWithSwappedRevisions(), and ApiParseTest\testUnfollowedRedirect().

◆ ensureMockDatabaseConnection()

MediaWikiTestCase::ensureMockDatabaseConnection ( IDatabase  $db)
protected
Exceptions
LogicExceptionif the given database connection is not a set up to use mock tables.
Since
1.31 this is no longer private.

Definition at line 1553 of file MediaWikiTestCase.php.

References dbPrefix(), and Wikimedia\Rdbms\IDatabase\tablePrefix().

Referenced by dropMockTables(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\getTestPage(), recloneMockTables(), setUpSchema(), and undoSchemaOverrides().

◆ getCliArg()

MediaWikiTestCase::getCliArg (   $offset)
Since
1.18
Parameters
string$offset
Returns
mixed

Definition at line 1920 of file MediaWikiTestCase.php.

Referenced by run(), StoreBatchTest\setUp(), BagOStuffTest\setUp(), JobQueueTest\setUp(), FileBackendTest\setUp(), and BagOStuffTest\testMerge_fork().

◆ getDefaultWikitextNS()

◆ getExistingTestPage()

◆ 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

Definition at line 1507 of file MediaWikiTestCase.php.

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

◆ getMutableTestUser()

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

Convenience method for getting a mutable test user.

Since
1.28
Parameters
string|string[]$groups Groups the test user should be added in.
Returns
TestUser

Definition at line 191 of file MediaWikiTestCase.php.

References TestUserRegistry\getMutableTestUser().

Referenced by LocalIdLookupTest\addDBData(), GenderCacheTest\addDBDataOnce(), ApiUserrightsTest\doFailedRightsChange(), ApiUserrightsTest\doSuccessfulRightsChange(), EnhancedChangesListTest\getCategorizationChange(), OldChangesListTest\getContext(), RCCacheEntryFactoryTest\getContext(), EnhancedChangesListTest\getEditChange(), OldChangesListTest\getEditChange(), EnhancedChangesListTest\getLogChange(), OldChangesListTest\getLogChange(), ApiUserrightsTest\getMockForProcessingExpiries(), OldChangesListTest\getNewBotEditChange(), BlockTest\getUserForBlocking(), ApiBlockTest\setUp(), ApiQueryWatchlistRawIntegrationTest\setUp(), ApiUnblockTest\setUp(), BotPasswordTest\setUp(), ApiQueryRecentChangesIntegrationTest\setUp(), ApiQueryWatchlistIntegrationTest\setUp(), UserGroupMembershipTest\testAddAndRemoveGroups(), ApiUserrightsTest\testAddAndRemoveGroups(), ApiMainTest\testAssert(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testAuthentication(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testBasics(), ApiBlockTest\testBlockByBlockedUser(), UserTest\testBlockInstanceCache(), UserTest\testCheckAndSetTouched(), ApiStashEditTest\testCheckCache(), UserTest\testEquals(), ApiBaseTest\testErrorArrayToStatus(), UserTest\testFindUsersByGroup(), UserTest\testGetEditCount(), UserTest\testIncEditCount(), UserTest\testLoggedIn(), ParserOptionsTest\testNewCanonical(), RCCacheEntryFactoryTest\testNewForDeleteChange(), RCCacheEntryFactoryTest\testNewForRevUserDeleteChange(), RCCacheEntryFactoryTest\testNewFromRecentChange(), UserTest\testOptions(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testProviderChangeAuthenticationData(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testSetPasswordResetFlag(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testTestUserCanAuthenticate(), ApiUserrightsTest\testWebToken(), ApiUserrightsTest\testWithTag(), and ApiUserrightsTest\testWithTagNewBackend().

◆ getNewTempDirectory()

MediaWikiTestCase::getNewTempDirectory ( )
protected

obtains a new temporary directory

The obtained directory is enlisted to be removed (recursively with all its contained files) upon tearDown.

Since
1.20
Returns
string Absolute name of the temporary directory

Definition at line 488 of file MediaWikiTestCase.php.

References getNewTempFile(), and wfMkdirParents().

Referenced by MediaWiki\Tests\Maintenance\TextPassDumperDatabaseTest\checkpointHelper(), MigrateFileRepoLayoutTest\setUp(), MediaWikiMediaTestCase\setUp(), StoreBatchTest\setUp(), FileBackendTest\setUp(), ApiQuerySiteinfoTest\testExtensions(), ApiUploadTest\testUpload(), ApiUploadTest\testUploadChunks(), ApiUploadTest\testUploadSameContent(), ApiUploadTest\testUploadSameFileName(), and ApiUploadTest\testUploadStash().

◆ getNewTempFile()

MediaWikiTestCase::getNewTempFile ( )
protected

Obtains a new temporary file name.

The obtained filename is enlisted to be removed upon tearDown

Since
1.20
Returns
string Absolute name of the temporary file

Definition at line 471 of file MediaWikiTestCase.php.

References class, and wfTempDir().

Referenced by MediaWiki\Tests\Maintenance\TextPassDumperDatabaseTest\checkpointHelper(), ReadOnlyModeTest\createFile(), UploadBaseTest\createFileOfSize(), FileBackendTest\doTestConcatenate(), ApiUploadTestCase\fakeUploadChunk(), ApiUploadTestCase\fakeUploadFile(), getNewTempDirectory(), GlobalTest\setUp(), UploadStashTest\setUp(), MediaWiki\Tests\Maintenance\BaseDumpTest\setUpPrefetch(), MediaWiki\Tests\Maintenance\TextPassDumperDatabaseTest\setUpStub(), UploadBaseTest\testCheckXMLEncodingMissmatch(), ReadOnlyModeTest\testClearCache(), MediaWiki\Tests\Maintenance\BackupDumperPageTest\testCurrentStubGzip(), MediaWiki\Tests\Maintenance\BackupDumperPageTest\testCurrentStubPlain(), GlobalTest\testDebugFunctionTest(), MediaWiki\Tests\Maintenance\BackupDumperPageTest\testFullStubPlain(), MediaWiki\Tests\Maintenance\BackupDumperPageTest\testFullTextPlain(), ApiMainTest\testNonWhitelistedCorsWithCookies(), MediaWiki\Tests\Maintenance\TextPassDumperDatabaseTest\testPlain(), MediaWiki\Tests\Maintenance\BackupDumperLoggerTest\testPlain(), MediaWiki\Tests\Maintenance\TextPassDumperDatabaseTest\testPrefetchPlain(), JpegTest\testSwappingICCProfile(), ApiUploadTest\testUploadZeroLength(), GlobalTest\testWfMkdirParents(), MediaWiki\Tests\Maintenance\BackupDumperPageTest\testXmlDumpsBackupUseCase(), and MediaWiki\Tests\Maintenance\BackupDumperLoggerTest\testXmlDumpsBackupUseCaseLogging().

◆ getNonexistingTestPage()

MediaWikiTestCase::getNonexistingTestPage (   $title = null)
protected

Returns a WikiPage representing a non-existing page.

Since
1.32
Parameters
Title | string | null$title
Returns
WikiPage
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.

Definition at line 255 of file MediaWikiTestCase.php.

References $title, WikiPage\factory(), needsDB(), and Title\newFromText().

Referenced by TextContentTest\testDeletionUpdates(), and PoolWorkArticleViewTest\testDoWorkMissingPage().

◆ getSchemaOverrides()

static MediaWikiTestCase::getSchemaOverrides ( IMaintainableDatabase  $db)
protected

Stub.

If a test suite needs to test against a specific database schema, it should override this method and return the appropriate information from it.

Parameters
IMaintainableDatabase$dbThe DB connection to use for the mock schema. May be used to check the current state of the schema, to determine what overrides are needed.
Returns
array An associative array with the following fields:
  • 'scripts': any SQL scripts to run. If empty or not present, schema overrides are skipped.
  • 'create': A list of tables created (may or may not exist in the original schema).
  • 'drop': A list of tables dropped (expected to be present in the original schema).
  • 'alter': A list of tables altered (expected to be present in the original schema).

Definition at line 1582 of file MediaWikiTestCase.php.

Referenced by setUpSchema().

◆ getTestPrefixFor()

static MediaWikiTestCase::getTestPrefixFor ( IDatabase  $db)
static
Parameters
IDatabase$db
Returns
string
Since
1.32

Definition at line 1179 of file MediaWikiTestCase.php.

References Wikimedia\Rdbms\IDatabase\getType().

◆ getTestSysop()

static MediaWikiTestCase::getTestSysop ( )
static

Convenience method for getting an immutable admin test user.

Since
1.28
Parameters
string[]$groups Groups the test user should be added to.
Returns
TestUser

Definition at line 203 of file MediaWikiTestCase.php.

Referenced by BlockTest\addBlockForUser(), MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProviderTest\getBlockedUser(), ApiUserrightsTest\getMockForProcessingExpiries(), ApiStashEditTest\getStashKey(), ApiUnblockTest\setUp(), NoWriteWatchedItemStoreUnitTest\testAddWatch(), NoWriteWatchedItemStoreUnitTest\testAddWatchBatchForUser(), UserTest\testAutoblockCookieInauthentic(), UserTest\testAutoblockCookieInfiniteExpiry(), UserTest\testAutoblockCookieNoSecretKey(), UserTest\testAutoblockCookies(), UserTest\testAutoblockCookiesDisabled(), ApiUserrightsTest\testBlockedWithoutUserrights(), UserTest\testBlockInstanceCache(), MediaWiki\Auth\AuthManagerTest\testCheckAccountCreatePermissions(), ApiStashEditTest\testCheckCacheInterveningEdits(), ApiStashEditTest\testCheckCacheOldNoEdits(), NoWriteWatchedItemStoreUnitTest\testCountUnreadNotifications(), NoWriteWatchedItemStoreUnitTest\testCountWatchedItems(), BlockTest\testDeprecatedConstructor(), WikiPageDbTestBase\testDoDeleteArticleReal_suppress(), WikiPageDbTestBase\testDoDeleteArticleReal_userSysop(), ApiBaseTest\testErrorArrayToStatus(), ApiQueryInfoTest\testExecuteEditActionsFullBlock(), NoWriteWatchedItemStoreUnitTest\testGetNotificationTimestampsBatch(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetRcIdIfUnpatrolled_returnsZeroIfPatrolled(), RevisionDbTestBase\testGetUserAndText(), NoWriteWatchedItemStoreUnitTest\testGetWatchedItem(), NoWriteWatchedItemStoreUnitTest\testGetWatchedItemsForUser(), UserTest\testIpBlockCookieIgnoredWhenUserLoggedIn(), UserTest\testIpBlockCookieNotSet(), UserTest\testIpBlockCookieSet(), RevisionDbTestBase\testIsMinor_true(), RevisionDbTestBase\testIsUnpatrolled_returnsZeroIfPatrolled(), NoWriteWatchedItemStoreUnitTest\testIsWatched(), NoWriteWatchedItemStoreUnitTest\testLoadWatchedItem(), RCFeedIntegrationTest\testNotify(), MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProviderTest\testRangeBlock(), ChangesListSpecialPageTest\testRcHidepatrolledFilter(), ChangesListSpecialPageTest\testRcHideunpatrolledFilter(), ChangesListSpecialPageTest\testRcReviewStatusFilter(), NoWriteWatchedItemStoreUnitTest\testRemoveWatch(), NoWriteWatchedItemStoreUnitTest\testResetNotificationTimestamp(), MediaWiki\Tests\Revision\MutableRevisionRecordTest\testSetGetUser(), NoWriteWatchedItemStoreUnitTest\testSetNotificationTimestampsForUser(), NoWriteWatchedItemStoreUnitTest\testUpdateNotificationTimestamp(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testUserWasLastToEdit_false(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testUserWasLastToEdit_true(), AbstractChangesListSpecialPageTestCase\testValidateOptions(), and ApiUserrightsTest\testWebToken().

◆ getTestUser()

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

Convenience method for getting an immutable test user.

Since
1.28
Parameters
string|string[]$groups Groups the test user should be in.
Returns
TestUser

Definition at line 179 of file MediaWikiTestCase.php.

References TestUserRegistry\getImmutableTestUser().

Referenced by BlockTest\addXffBlocks(), RefreshLinksJobTest\createPage(), WikiPageDbTestBase\createPage(), MediaWiki\Tests\Storage\DerivedPageDataUpdaterTest\createRevision(), MediaWiki\Tests\Storage\PageUpdaterTest\createRevision(), PageArchivePreMcrTest\getExpectedArchiveRows(), PageArchiveMcrTest\getExpectedArchiveRows(), ArticleViewTest\getPage(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\getRevisionRecordFromDetailsArray(), PoolWorkArticleViewTest\makeRevision(), RevisionDbTestBase\makeRevisionWithProps(), OutputPageTest\provideCheckLastModified(), AbstractChangesListSpecialPageTestCase\setUp(), UserTest\setUp(), PageArchiveTestBase\setUp(), ApiMainTest\testAssertUser(), UserTest\testAutoblockCookieInauthentic(), UserTest\testAutoblockCookieInfiniteExpiry(), UserTest\testAutoblockCookieNoSecretKey(), UserTest\testAutoblockCookies(), UserTest\testAutoblockCookiesDisabled(), ApiStashEditTest\testBot(), ApiStashEditTest\testCheckCache(), MediaWiki\Tests\Storage\PageUpdaterTest\testCompareAndSwapFailure(), RevisionTest\testConstructFromArray_userSetAsExpected(), MediaWiki\Tests\Storage\PageUpdaterTest\testCreatePage(), ApiLoginTest\testDeprecatedUserLogin(), WikiPageDbTestBase\testDoDeleteUpdates(), WikiPageDbTestBase\testDoEditContent(), WikiPageDbTestBase\testDoEditUpdates(), ApiQueryInfoTest\testExecuteEditActionsFullBlock(), UserTest\testExperienceLevel(), MediaWiki\Tests\Storage\PageUpdaterTest\testFailureOnEditFlags(), SpecialWatchlistTest\testFetchOptionsFromRequest(), MediaWiki\Tests\Storage\DerivedPageDataUpdaterTest\testGetCanonicalParserOptions(), DefaultPreferencesFactoryTest\testGetForm(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetKnownCurrentRevision(), MediaWiki\Tests\Storage\DerivedPageDataUpdaterTest\testGetPreparedEditAfterPrepareContent(), PageArchiveTestBase\testGetPreviousRevision(), MediaWiki\Tests\Revision\RevisionRendererTest\testGetRenderedRevision_privileged(), MediaWiki\Tests\Revision\RenderedRevisionTest\testGetRevisionParserOutput_privileged(), MediaWiki\Tests\Storage\DerivedPageDataUpdaterTest\testGetSecondaryDataUpdatesAfterPrepareContent(), MediaWiki\Tests\Storage\DerivedPageDataUpdaterTest\testGetSecondaryDataUpdatesWithSlotRemoval(), MediaWiki\Tests\Revision\RevisionStoreRecordTest\testGetSlot_audience_latest(), WikitextContentTest\testHadSignature(), MediaWiki\Tests\Storage\PageUpdaterTest\testInheritSlot(), MediaWiki\Tests\Revision\McrRevisionStoreDbTest\testInsertRevisionOn_T202032(), ActorMigrationTest\testInsertRoundTrip(), ActorMigrationTest\testInsertUserIdentity(), ActorMigrationTest\testInsertWithTempTableCallbackMissingFields(), ActorMigrationTest\testInsertWithTempTableDeprecated(), ActorMigrationTest\testInsertWithTempTableWrong(), ActorMigrationTest\testInsertWrong(), UserTest\testIpBlockCookieIgnoredWhenUserLoggedIn(), UserTest\testNewFromAnyId(), UserTest\testNewFromIdentity(), RecentChangeTest\testNewFromRow(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewRevisionFromRow_userEdit(), MediaWiki\Tests\Storage\DerivedPageDataUpdaterTest\testPrepareContent(), WikiPageDbTestBase\testPrepareContentForEdit(), MediaWiki\Tests\Storage\DerivedPageDataUpdaterTest\testPrepareContentInherit(), MediaWiki\Tests\Storage\DerivedPageDataUpdaterTest\testPrepareUpdateOutputReset(), MediaWiki\Tests\Storage\DerivedPageDataUpdaterTest\testPrepareUpdateReusesParserOutput(), ChangesListSpecialPageTest\testRcHidebyothersFilter(), ChangesListSpecialPageTest\testRcHidemyselfFilter(), ChangesListSpecialPageTest\testRcHidepatrolledDisabledFilter(), ChangesListSpecialPageTest\testRcHideunpatrolledDisabledFilter(), MediaWiki\Tests\Storage\PageUpdaterTest\testSetRcPatrolStatus(), MediaWiki\Tests\Storage\PageUpdaterTest\testSetUseAutomaticEditSummaries(), MediaWiki\Tests\Storage\PageUpdaterTest\testSetUsePageCreationLog(), UserTest\testSoftBlockRanges(), ApiPageSetTest\testSpecialRedirects(), ApiUnblockTest\testUnblockSelfWhenBlocked(), ApiUnblockTest\testUnblockWhenBlocked(), ArticleViewTest\testUnhiddenViewOfDeletedRevision(), ImportTest\testUnknownUserHandling(), MediaWiki\Tests\Storage\PageUpdaterTest\testUpdatePage(), RevisionDbTestBase\testUserCan(), RevisionDbTestBase\testUserCanBitfield(), UserTest\testUserGetRightsHooks(), and ArticleViewTest\testViewMissingUserPage().

◆ hideDeprecated()

MediaWikiTestCase::hideDeprecated (   $function)

Don't throw a warning if $function is deprecated and called later.

Since
1.19
Parameters
string$function

Definition at line 1940 of file MediaWikiTestCase.php.

References wfDeprecated().

Referenced by MediaWiki\Auth\LegacyHookPreAuthenticationProviderTest\hook(), CommentStoreTest\makeStoreWithKey(), UserTest\testActorId(), OutputPageTest\testAddAcceptLanguage(), OutputPageTest\testAddDeprecatedScriptFileNoOp(), OutputPageTest\testAddWikiText(), ArticleViewTest\testArticleAfterFetchContentObjectHook(), ArticleViewTest\testArticleContentViewCustomHook(), MediaWiki\Auth\AuthManagerTest\testAutoAccountCreation(), BlockTest\testDeprecatedConstructor(), ApiEditPageTest\testEditAbortedByHook(), ApiEditPageTest\testEditAbortedByHookWithCustomOutput(), RevisionDbTestBase\testFetchRevision(), PageArchiveTestBase\testGetLastRevisionText(), LBFactoryTest\testGetLBFactoryClass(), PageArchivePreMcrTest\testGetTextFromRow(), PageArchiveTestBase\testGetTextFromRowThrowsInvalidArgumentException(), WatchActionTest\testGetUnwatchToken(), ActorMigrationTest\testInsertWithTempTableDeprecated(), CommentStoreTest\testInsertWithTempTableDeprecated(), UserTest\testIsLocallyBlockedProxy(), SearchResultSetTest\testIterate(), DeprecatedGlobalTest\testLazyLoad(), LinkerTest\testLinkBeginHook(), LinkerTest\testLinkEndHook(), RevisionDbTestBase\testLoadFromId(), CommentStoreTest\testNewKey(), DeprecatedGlobalTest\testObjectDeStub(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionPageJoinCond(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionSelectArchiveFields(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionSelectFields(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionSelectPageFields(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionSelectTextFields(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionSelectUserFields(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionUserJoinCond(), MediaWiki\Session\PHPSessionHandlerTest\testSessionHandling(), MediaWikiTestCaseTest\testStashedGlobalsAreRestoredOnTearDown(), OutputPageTest\testVaryHeaders(), WfArrayFilterTest\testWfArrayFilter(), and WfArrayFilterTest\testWfArrayFilterByKey().

◆ insertPage()

MediaWikiTestCase::insertPage (   $pageName,
  $text = 'Sample page for unit test.',
  $namespace = null,
User  $user = 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 | null$namespaceNamespace id (name cannot already contain namespace)
User | null$userIf null, static::getTestSysop()->getUser() is used.
Returns
array Title object and page id
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.

Definition at line 1219 of file MediaWikiTestCase.php.

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

Referenced by MergeHistoryTest\addDBDataOnce(), PrefixSearchTest\addDBDataOnce(), SearchEnginePrefixTest\addDBDataOnce(), CategoryMembershipChangeJobTest\addDBDataOnce(), SearchEngineTest\addDBDataOnce(), ContentHandlerTest\addDBDataOnce(), LinksUpdateTest\addDBDataOnce(), CategoryMembershipChangeTest\addDBDataOnce(), MediaWiki\Tests\Storage\PageUpdaterTest\testMagicWords(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewMutableRevisionFromArray(), and MediaWiki\Tests\Storage\PageUpdaterTest\testUpdatePage().

◆ installMockMwServices()

static MediaWikiTestCase::installMockMwServices ( Config  $configOverrides = null)
static

Creates a new "mock" MediaWikiServices instance, and installs it.

This effectively resets all cached states in services, with the exception of the ConfigFactory and the DBLoadBalancerFactory service, which are inherited from the original MediaWikiServices.

Note
The new original MediaWikiServices instance can later be restored by calling restoreMwServices(). That original is determined by the first call to this method, or by setUpBeforeClass, whichever is called first. The caller is responsible for managing and, when appropriate, destroying any other MediaWikiServices instances that may get replaced when calling this method.
Parameters
Config | null$configOverridesConfiguration overrides for the new MediaWikiServices instance.
Returns
MediaWikiServices the new mock service locator.

Definition at line 975 of file MediaWikiTestCase.php.

References $services, MediaWikiServices, Hooks\run(), and use.

Referenced by ParserTestTopLevelSuite\setUp().

◆ isNotUnittest()

static MediaWikiTestCase::isNotUnittest (   $table)
staticprivate

Definition at line 1842 of file MediaWikiTestCase.php.

◆ isTestInDatabaseGroup()

MediaWikiTestCase::isTestInDatabaseGroup ( )
protected
Returns
bool
Since
1.32

Definition at line 1196 of file MediaWikiTestCase.php.

Referenced by needsDB(), and run().

◆ isUsingExternalStoreDB()

static MediaWikiTestCase::isUsingExternalStoreDB ( )
staticprotected

Check whether ExternalStoreDB is being used.

Returns
bool True if it's being used

Definition at line 1531 of file MediaWikiTestCase.php.

References $wgDefaultExternalStore, array(), and as.

◆ 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

Definition at line 2160 of file MediaWikiTestCase.php.

References $wgNamespaceContentModels, and CONTENT_MODEL_WIKITEXT.

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

◆ listOriginalTables()

MediaWikiTestCase::listOriginalTables ( IMaintainableDatabase  $db,
  $prefix = 'prefixed' 
)
private

Lists all tables in the live database schema.

Parameters
IMaintainableDatabase$db
string$prefixEither 'prefixed' or 'unprefixed'
Returns
array

Definition at line 1709 of file MediaWikiTestCase.php.

References Wikimedia\Rdbms\IMaintainableDatabase\listTables(), and use.

Referenced by recloneMockTables(), setUpSchema(), and undoSchemaOverrides().

◆ listTables()

static MediaWikiTestCase::listTables ( IMaintainableDatabase  $db)
static

◆ 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

Definition at line 287 of file MediaWikiTestCase.php.

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

◆ makeTestConfigFactoryInstantiator()

static MediaWikiTestCase::makeTestConfigFactoryInstantiator ( ConfigFactory  $oldFactory,
array  $configurations 
)
staticprivate
Parameters
ConfigFactory$oldFactory
Config[]$configurations
Returns
Closure

Definition at line 331 of file MediaWikiTestCase.php.

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

◆ markTestSkippedIfDbType()

◆ 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

Definition at line 2232 of file MediaWikiTestCase.php.

References $wgDiff3.

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

◆ 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

Definition at line 901 of file MediaWikiTestCase.php.

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

Referenced by MediaWiki\Tests\Maintenance\TextPassDumperDatabaseTest\addDBData(), GenderCacheTest\addDBDataOnce(), MediaWiki\Tests\Storage\DerivedPageDataUpdaterTest\defineMockContentModelForUpdateTesting(), WikiPageDbTestBase\defineMockContentModelForUpdateTesting(), MediaWiki\Auth\LegacyHookPreAuthenticationProviderTest\hook(), DifferenceEngineTest\provideGenerateContentDiffBody(), TextSlotDiffRendererTest\provideGetDiff(), ApiUserrightsTest\setPermissions(), setTemporaryHook(), PageLangLogFormatterTest\setUp(), NewUsersLogFormatterTest\setUp(), AutoLoaderTest\setUp(), TitleMethodsTest\setUp(), ApiRevisionDeleteTest\setUp(), EditPageTest\setUp(), ApiEditPageTest\setUp(), BotPasswordTest\setUp(), ApiOptionsTest\setUp(), PagePropsTest\setUp(), RevisionDbTestBase\setUp(), SearchEngineTest\testAugmentorSearch(), MediaWiki\Auth\AuthManagerTest\testAutoAccountCreation(), UserTest\testAutoblockCookieInauthentic(), UserTest\testAutoblockCookieInfiniteExpiry(), UserTest\testAutoblockCookieNoSecretKey(), UserTest\testAutoblockCookies(), UserTest\testAutoblockCookiesDisabled(), ApiBlockTest\testBlockWithHide(), TitleTest\testCreateFragmentTitle(), MediaWiki\Session\SessionBackendTest\testDelaySave(), ApiDisabledTest\testDisabled(), ApiQueryDisabledTest\testDisabled(), PasswordResetTest\testExecute_email(), SpecialMyLanguageTest\testFindTitle(), SpecialPageFactoryTest\testGetAliasListRecursion(), UserTest\testGetCanonicalName(), SpecialPageFactoryTest\testGetNames(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest\testGetNewPasswordExpiry(), SpecialPageFactoryTest\testGetPage(), ContentHandlerTest\testGetSlotDiffRenderer_bc(), ContentHandlerTest\testGetSlotDiffRenderer_default(), ContentHandlerTest\testGetSlotDiffRenderer_hook(), ContentHandlerTest\testGetSlotDiffRenderer_nobc(), SpecialPageFactoryTest\testHookNotCalledTwice(), JobTest\testJobFactory(), ApiMainTest\testLacksSameOriginSecurity(), MediaWiki\Session\SessionManagerTest\testLoadSessionInfoFromStore(), ApiMoveTest\testMoveSubpages(), ApiQuerySiteinfoTest\testNamespaceAliases(), ApiMainTest\testNonWhitelistedCorsWithCookies(), MediaWiki\Session\CookieSessionProviderTest\testPersistSession(), MediaWiki\Session\CookieSessionProviderTest\testPersistSessionWithHook(), ApiMoveTest\testPingLimiter(), ApiStashEditTest\testPingLimiter(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testProviderChangeAuthenticationData(), MediaWiki\Auth\AbstractPrimaryAuthenticationProviderTest\testProviderNormalizeUsername(), LocalisationCacheTest\testRecacheFallbacksWithHooks(), MediaWiki\Session\SessionBackendTest\testRenew(), MediaWiki\Session\SessionBackendTest\testSave(), ApiParseTest\testSerializationError(), MediaWiki\Session\PHPSessionHandlerTest\testSessionHandling(), MediaWiki\Auth\ThrottlePreAuthenticationProviderTest\testTestForAccountCreation(), ApiLoginTest\testUnsupportedAuthResponseType(), UserTest\testUserGetRightsHooks(), and MediaWiki\Auth\LegacyHookPreAuthenticationProviderTest\unhook().

◆ mungeSchemaUpdateQuery()

MediaWikiTestCase::mungeSchemaUpdateQuery (   $cmd)
private

Definition at line 1681 of file MediaWikiTestCase.php.

Referenced by setUpSchema().

◆ needsDB()

MediaWikiTestCase::needsDB ( )

◆ objectAssociativeSort()

MediaWikiTestCase::objectAssociativeSort ( array $array)
protected

Does an associative sort that works for objects.

Since
1.20
Parameters
array&$array

Definition at line 2081 of file MediaWikiTestCase.php.

References serialize().

Referenced by assertArrayEquals(), and MediaWiki\Tests\Revision\RevisionQueryInfoTest\assertArrayEqualsIgnoringIntKeyOrder().

◆ oncePerClass()

MediaWikiTestCase::oncePerClass ( )
private
Returns
bool

Definition at line 440 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 | null$configOverridesConfiguration overrides for the new MediaWikiServices instance.
callable[]$services An associative array of services to re-define. Keys are service names, values are callables.
Returns
MediaWikiServices
Exceptions
MWException

Definition at line 934 of file MediaWikiTestCase.php.

References $name, $services, and as.

Referenced by ApiQueryUserContribsTest\addDBDataOnce(), resetDB(), run(), UserTest\setUp(), TitlePermissionTest\setUp(), PrefixSearchTest\setUp(), SearchEnginePrefixTest\setUp(), WikiPageDbTestBase\setUp(), RevisionDbTestBase\setUp(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\setUp(), PageArchiveTestBase\setUp(), InterwikiTest\setWgInterwikiCache(), SpecialPageFactoryTest\testConflictResolution(), RevisionTest\testConstructFromRowWithBadPageId(), ChangesListSpecialPageTest\testFilterUserExpLevelAllExperienceLevels(), ChangesListSpecialPageTest\testFilterUserExpLevelRegistrered(), ChangesListSpecialPageTest\testFilterUserExpLevelRegistreredOrLearner(), ChangesListSpecialPageTest\testFilterUserExpLevelUnregistrered(), ChangesListSpecialPageTest\testFilterUserExpLevelUnregistreredOrExperienced(), SpecialPageFactoryTest\testGetAliasListRecursion(), SpecialPageFactoryTest\testGetLocalNameFor(), SpecialPageFactoryTest\testGetNames(), SpecialPageFactoryTest\testGetPage(), SpecialPageFactoryTest\testGetTitleForAlias(), SpecialPageFactoryTest\testHookNotCalledTwice(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testInsertRevisionOn_blobAddressExists(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testInsertRevisionOn_successes(), ActorMigrationTest\testInsertUserIdentity(), ApiQueryUserContribsTest\testInterwikiUser(), RevisionTest\testLoadFromTitle(), ObjectCacheTest\testNewAnythingNoAccelNoDb(), ObjectCacheTest\testNewAnythingNothingNoDb(), RevisionDbTestBase\testNewKnownCurrent(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewNullRevision(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewRevisionFromArchiveRow_legacyEncoding(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewRevisionFromRow_anonEdit_legacyEncoding(), MediaWikiTestCaseTest\testOverrideMwServices(), ChangesListSpecialPageTest\testRcHidebyothersFilter(), ChangesListSpecialPageTest\testRcHidemyselfFilter(), MessageCacheTest\testReplaceCache(), SpecialPageFactoryTest\testResolveAlias(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionGetArchiveQueryInfo(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionGetQueryInfo(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionSelectArchiveFields(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionSelectFields(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionStoreGetArchiveQueryInfo(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionStoreGetQueryInfo(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionStoreGetSlotsQueryInfo(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionUserJoinCond(), and ApiQueryUserContribsTest\testSorting().

◆ prepareServices()

static MediaWikiTestCase::prepareServices ( Config  $bootstrapConfig)
static
Deprecated:
since 1.32

Definition at line 275 of file MediaWikiTestCase.php.

◆ recloneMockTables()

MediaWikiTestCase::recloneMockTables ( IMaintainableDatabase  $db,
array  $tables 
)
private

Re-clones the given mock tables to restore them based on the live database schema.

The tables listed in $tables are expected to currently not exist, so dropMockTables() should be called first.

Parameters
IMaintainableDatabase$db
array$tables

Definition at line 1736 of file MediaWikiTestCase.php.

References ensureMockDatabaseConnection(), listOriginalTables(), Wikimedia\Rdbms\IDatabase\tablePrefix(), and CloneDatabase\useTemporaryTables().

Referenced by undoSchemaOverrides().

◆ 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

Definition at line 1758 of file MediaWikiTestCase.php.

References addCoreDBData(), as, TestUserRegistry\clear(), Wikimedia\Rdbms\IDatabase\getType(), overrideMwServices(), and truncateTable().

Referenced by run().

◆ resetNamespaces()

MediaWikiTestCase::resetNamespaces ( )
private

Must be called whenever namespaces are changed, e.g., $wgExtraNamespaces is altered.

Otherwise old namespace data will lurk and cause bugs.

Definition at line 752 of file MediaWikiTestCase.php.

References MWNamespace\clearCaches(), and Language\clearCaches().

Referenced by doSetMwGlobals(), and tearDown().

◆ resetNonServiceCaches()

static MediaWikiTestCase::resetNonServiceCaches ( )
static

◆ restoreLoggers()

MediaWikiTestCase::restoreLoggers ( )
private

Restores loggers replaced by setLogger().

Since
1.27

Definition at line 1143 of file MediaWikiTestCase.php.

References as.

Referenced by tearDown().

◆ restoreMwServices()

static MediaWikiTestCase::restoreMwServices ( )
static

Restores the original, non-mock MediaWikiServices instance.

The previously active MediaWikiServices instance is destroyed, if it is different from the original that is to be restored.

Note
this if for internal use by test framework code. It should never be called from inside a test case, a data provider, or a setUp or tearDown method.
Returns
bool true if the original service locator was restored, false if there was nothing too do.

Definition at line 1033 of file MediaWikiTestCase.php.

Referenced by ParserTestTopLevelSuite\setUp().

◆ revisionDelete()

MediaWikiTestCase::revisionDelete (   $rev,
array  $value = Revision::DELETED_TEXT =,
1]  ,
  $comment = '' 
)
protected

Revision-deletes a revision.

Parameters
Revision | int$revRevision to delete
array$valueKeys are Revision::DELETED_* flags. Values are 1 to set the bit, 0 to clear, -1 to leave alone. (All other values also clear the bit.)
string$commentDeletion comment

Definition at line 2353 of file MediaWikiTestCase.php.

References $rev, $value, RevisionDeleter\createList(), RequestContext\getMain(), and Revision\newFromId().

Referenced by ApiParseTest\addDBDataOnce(), ApiStashEditTest\testDeletedRevision(), and ApiStashEditTest\testDeletedRevisionSection().

◆ run()

MediaWikiTestCase::run ( PHPUnit_Framework_TestResult  $result = null)

◆ setCliArg()

MediaWikiTestCase::setCliArg (   $offset,
  $value 
)
Since
1.18
Parameters
string$offset
mixed$value

Definition at line 1929 of file MediaWikiTestCase.php.

References $value.

◆ setContentLang()

MediaWikiTestCase::setContentLang (   $lang)
Since
1.27
Parameters
string | Language$lang

Definition at line 1063 of file MediaWikiTestCase.php.

References $lang, $services, doSetMwGlobals(), setMwGlobals(), and setService().

Referenced by MediaWiki\Tests\Maintenance\BackupDumperPageTest\addDBData(), MessageCacheTest\configureLanguages(), HtmlTest\setUp(), StripStateTest\setUp(), LanguageConverterTest\setUp(), MediaWikiLangTestCase\setUp(), TitleTest\setUp(), SampleTest\setUp(), SpecialPageTest\setUp(), EditPageTest\setUp(), ExtraParserTest\setUp(), CategoryMembershipChangeJobTest\setUp(), ApiOptionsTest\setUp(), SubpageImportTitleFactoryTest\setUp(), NaiveImportTitleFactoryTest\setUp(), NamespaceImportTitleFactoryTest\setUp(), MediaWikiTitleCodecTest\setUp(), MagicVariableTest\setUp(), CategoryMembershipChangeTest\setUp(), OutputPageTest\setupCategoryTests(), DifferenceEngineTest\testAddLocalisedTitleTooltips(), SpecialPageFactoryTest\testConflictResolution(), InterwikiTest\testConstructor(), SpecialMyLanguageTest\testFindTitle(), ContentHandlerTest\testGetAutosummary(), SpecialPageFactoryTest\testGetLocalNameFor(), TitleTest\testGetPageViewLanguage(), LanguageConverterTest\testGetPreferredVariantDefaultLanguageVsUrlVariant(), LanguageConverterTest\testGetPreferredVariantHeaderUserVsUrl(), LanguageConverterTest\testGetPreferredVariantUserOptionForForeignLanguage(), LanguageConverterTest\testGetPreferredVariantUserOptionForForeignLanguageBCP47(), LanguageConverterTest\testGetPreferredVariantUserOptionForForeignLanguageDeprecated(), SpecialPageFactoryTest\testGetTitleForAlias(), ApiQuerySiteinfoTest\testLinkPrefixCharset(), ParserOptionsTest\testNewCanonical(), SpecialPageFactoryTest\testResolveAlias(), MediaWiki\Auth\AuthManagerTest\testSetDefaultUserOptions(), MediaWiki\Tests\Storage\PageUpdaterTest\testSetUseAutomaticEditSummaries(), SpecialPageDataTest\testSpecialPageWithoutParameters(), ArticleTablesTest\testTemplatelinksUsesContentLanguage(), and ApiQuerySiteinfoTest\testVariants().

◆ setGroupPermissions()

MediaWikiTestCase::setGroupPermissions (   $newPerms,
  $newKey = null,
  $newValue = null 
)

Alters $wgGroupPermissions for the duration of the test.

Can be called with an array, like [ '*' => [ 'read' => false ], 'user' => [ 'read' => false ] ] or three values to set a single permission, like $this->setGroupPermissions( '*', 'read', false );

Since
1.31
Parameters
array | string$newPermsEither an array of permissions to change, in which case the next two parameters are ignored; or a single string identifying a group, to use with the next two parameters.
string | null$newKey
mixed | null$newValue

Definition at line 1092 of file MediaWikiTestCase.php.

References $value, $wgGroupPermissions, as, and setMwGlobals().

Referenced by ApiUserrightsTest\setPermissions(), LocalIdLookupTest\setUp(), MediaWiki\Auth\AuthManagerTest\testAutoAccountCreation(), ApiLoginTest\testBotPasswordThrottled(), MediaWiki\Auth\AuthManagerTest\testCheckAccountCreatePermissions(), ApiMainTest\testCheckExecutePermissionsReadProhibited(), ApiMainTest\testCheckExecutePermissionWriteApiProhibited(), ApiMainTest\testSetCacheModePrivateWiki(), ApiParseTest\testSuppressed(), ApiMoveTest\testSuppressRedirectNoPermission(), ApiMoveTest\testTagsNoPermission(), ApiUnblockTest\testUnblockNoPermission(), ApiUnblockTest\testUnblockWithProhibitedTag(), ApiQuerySiteinfoTest\testUserGroups(), and ApiUserrightsTest\testWithoutTagPermission().

◆ setIniSetting()

MediaWikiTestCase::setIniSetting (   $name,
  $value 
)
protected

Set an ini setting for the duration of the test.

Parameters
string$nameName of the setting
string$valueValue to set
Since
1.32

Definition at line 742 of file MediaWikiTestCase.php.

References $name, and $value.

Referenced by LanguageConverterTest\testAutoConvertT124404().

◆ setLogger()

◆ setMwGlobals()

MediaWikiTestCase::setMwGlobals (   $pairs,
  $value = null 
)
protected

Sets a global, maintaining a stashed version of the previous global to be restored in tearDown.

The key is added to the array of globals that will be reset afterwards in the tearDown().

Example
protected function setUp() {
$this->setMwGlobals( 'wgRestrictStuff', true );
}
function testFoo() {}
function testBar() {}
$this->assertTrue( self::getX()->doStuff() );
$this->setMwGlobals( 'wgRestrictStuff', false );
$this->assertTrue( self::getX()->doStuff() );
}
function testQuux() {}
Parameters
array | string$pairsKey to the global variable, or an array of key/value pairs.
mixed | null$valueValue to set the global to (ignored if an array is given as first argument).
Note
To allow changes to global variables to take effect on global service instances, call overrideMwServices().
Since
1.21

Definition at line 706 of file MediaWikiTestCase.php.

References $value, and doSetMwGlobals().

Referenced by SearchEngineTest\addDBDataOnce(), EditPageTest\assertEdit(), OutputPageTest\assertTransformCssMediaCase(), ApiFormatBaseTest\encodeData(), mergeMwGlobalArrayValue(), ApiQuerySearchTest\registerMockSearchEngine(), PrefixSearchTest\searchProvision(), SearchEnginePrefixTest\searchProvision(), TitleTest\secureAndSplitGlobals(), ObjectCacheTest\setCacheConfig(), setContentLang(), setGroupPermissions(), MWGrantsTest\setUp(), ImagePageTest\setUp(), ObjectCacheTest\setUp(), HtmlTest\setUp(), MediaWikiTest\setUp(), ResourceLoaderTest\setUp(), MWTimestampTest\setUp(), PageLangLogFormatterTest\setUp(), XmlTest\setUp(), BitmapScalingTest\setUp(), FormatMetadataTest\setUp(), BitmapMetadataHandlerTest\setUp(), LocalisationCacheTest\setUp(), MWCryptHKDFTest\setUp(), CategoryChangesRdfTest\setUp(), LanguageConverterTest\setUp(), JpegTest\setUp(), ContentSecurityPolicyTest\setUp(), LocalFileTest\setUp(), TitleTest\setUp(), GlobalTest\setUp(), ApiUploadTestCase\setUp(), MWNamespaceTest\setUp(), ApiQueryTest\setUp(), SampleTest\setUp(), TemplateParserTest\setUp(), UploadBaseTest\setUp(), UploadFromUrlTest\setUp(), WfThumbIsStandardTest\setUp(), WikiMapTest\setUp(), CSSMinTest\setUp(), LinkFilterTest\setUp(), ContentHandlerTest\setUp(), MessageTest\setUp(), ImagePage404Test\setUp(), ApiStashEditTest\setUp(), SpecialPageTest\setUp(), ExifTest\setUp(), CssContentTest\setUp(), ApiQueryPrefixSearchTest\setUp(), ApiComparePagesTest\setUp(), SpecialWatchlistTest\setUp(), ExifBitmapTest\setUp(), SVGTest\setUp(), TiffTest\setUp(), ApiFormatBaseTest\setUp(), TextContentTest\setUp(), RCFeedIntegrationTest\setUp(), ExportTest\setUp(), ActionTest\setUp(), MediaWiki\Auth\UserDataAuthenticationRequestTest\setUp(), ApiTestCase\setUp(), ExifRotationTest\setUp(), ApiEditPageTest\setUp(), EditPageTest\setUp(), DeprecationHelperTest\setUp(), ExtraParserTest\setUp(), LinkRendererTest\setUp(), AbstractChangesListSpecialPageTestCase\setUp(), UserTest\setUp(), RevisionTest\setUp(), BotPasswordTest\setUp(), SearchEngineTest\setUp(), CategoryMembershipChangeJobTest\setUp(), UserGroupMembershipTest\setUp(), OldChangesListTest\setUp(), TitlePermissionTest\setUp(), WfParseUrlTest\setUp(), ParserOptionsTest\setUp(), SubpageImportTitleFactoryTest\setUp(), NaiveImportTitleFactoryTest\setUp(), PagePropsTest\setUp(), RCCacheEntryFactoryTest\setUp(), MediaWikiTitleCodecTest\setUp(), LinksUpdateTest\setUp(), PreferencesTest\setUp(), MediaWiki\Auth\AuthManagerTest\setUp(), DefaultPreferencesFactoryTest\setUp(), GitInfoTest\setUp(), PrefixSearchTest\setUp(), LogFormatterTest\setUp(), SearchEnginePrefixTest\setUp(), MediaWiki\Session\BotPasswordSessionProviderTest\setUp(), WikiPageDbTestBase\setUp(), RevisionDbTestBase\setUp(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\setUp(), ResourceLoaderTestCase\setUp(), PageArchiveTestBase\setUp(), MediaWiki\Tests\Maintenance\DumpTestCase\setUp(), OutputPageTest\setupCategoryTests(), ApiLoginTest\setUpForBotPassword(), RepoGroupTest\setUpForeignRepo(), ApiParseTest\setupInterwiki(), setUserLang(), InterwikiTest\setWgInterwikiCache(), DeferredUpdatesTest\testAddCallableUpdate(), DeferredUpdatesTest\testAddMergeable(), ApiFormatBaseTest\testApiFrameOptions(), FileBackendTest\testAsyncWrites(), MediaWiki\Auth\AuthManagerTest\testAutoAccountCreation(), UserTest\testAutoblockCookieInauthentic(), UserTest\testAutoblockCookieInfiniteExpiry(), UserTest\testAutoblockCookieNoSecretKey(), UserTest\testAutoblockCookies(), UserTest\testAutoblockCookiesDisabled(), BotPasswordTest\testBasics(), ApiBlockTest\testBlockWithProhibitedEmailBlock(), ApiBlockTest\testBlockWithProhibitedTag(), ApiBlockTest\testBlockWithTag(), ApiBlockTest\testBlockWithTagNewBackend(), ApiLoginTest\testBotPasswordThrottled(), OutputPageTest\testBuildExemptModules(), FileTest\testCanAnimateThumbIfAppropriate(), MediaWiki\Tests\Maintenance\CategoriesRdfTest\testCategoriesDump(), MediaWiki\Auth\AuthManagerTest\testCheckAccountCreatePermissions(), ApiMainTest\testCheckConditionalRequestHeaders(), ApiMainTest\testCheckConditionalRequestHeadersFailed(), ApiMainTest\testCheckMaxLagExceeded(), ApiMainTest\testCheckMaxLagExceededWithHostNames(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest\testCheckPasswordValidity(), UserTest\testCheckPasswordValidity(), PasswordPolicyChecksTest\testCheckPopularPasswordBlacklist(), ExtraParserTest\testCleanSigDisabled(), SpecialPageFactoryTest\testConflictResolution(), RevisionTest\testConstructFromArray_userSetAsExpected(), RevisionTest\testConstructFromRowWithBadPageId(), MediaWiki\Auth\ThrottlerTest\testConstructor(), GlobalVarConfigTest\testConstructor(), ResourceLoaderTest\testConstructRegistrationHook(), ApiQuerySiteinfoTest\testContinuation(), MediaWiki\Session\CookieSessionProviderTest\testCookieData(), ApiEditPageTest\testCreateImageRedirectLoggedIn(), EditPageTest\testCreatePage(), EditPageTest\testCreatePageTrx(), ContentSecurityPolicyTest\testCSPIsEnabled(), ApiQuerySiteinfoTest\testDbReplLagInfo(), GlobalTest\testDebugFunctionTest(), ChangeTagsTest\testDeleteTagsMigrationOld(), ChangeTagsTest\testDeleteTagsMigrationWriteBoth(), ApiDeleteTest\testDeleteWithoutTagPermission(), ApiDeleteTest\testDeleteWithTag(), ApiDeleteTest\testDeleteWithTagNewBackend(), ApiLoginTest\testDeprecatedUserLogin(), WebRequestTest\testDetectServer(), ApiFormatBaseTest\testDisable(), ApiParseTest\testDisableTidy(), ApiStructureTest\testDocumentationExists(), WikiPageDbTestBase\testDoEditContent(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testDomainCheck(), SiteStatsUpdateTest\testDoUpdate(), DeferredUpdatesTest\testDoUpdatesCLI(), DeferredUpdatesTest\testDoUpdatesWeb(), MediaWiki\Tests\Maintenance\PopulateChangeTagDefTest\testDryRunMigrationNew(), MediaWiki\Tests\Maintenance\PopulateChangeTagDefTest\testDryRunMigrationWriteBoth(), AutopromoteTest\testEditCountLookupIsSkippedIfRequirementIsZero(), ApiEditPageTest\testEditWithoutTagPermission(), ApiEditPageTest\testEditWithTag(), ApiEditPageTest\testEditWithTagNewBackend(), SanitizerTest\testEscapeIdForStuff(), BadTitleErrorTest\testExceptionSetsStatusCode(), ThrottledErrorTest\testExceptionSetsStatusCode(), UserTest\testExperienceLevel(), ExtensionRegistryTest\testExportExtractedDataGlobals(), ApiLoginTest\testExtendedDescription(), ApiQuerySiteinfoTest\testExtensions(), SideBarTest\testExternalUrlsRequireADescription(), CentralIdLookupTest\testFactory(), ApiQuerySiteinfoTest\testFileExtensions(), ChangesListSpecialPageTest\testFilterUserExpLevel(), ChangesListSpecialPageTest\testFilterUserExpLevelAllExperienceLevels(), ChangesListSpecialPageTest\testFilterUserExpLevelRegistrered(), ChangesListSpecialPageTest\testFilterUserExpLevelRegistreredOrLearner(), ChangesListSpecialPageTest\testFilterUserExpLevelUnregistrered(), ChangesListSpecialPageTest\testFilterUserExpLevelUnregistreredOrExperienced(), RepoGroupTest\testForEachForeignRepoNone(), LinkerTest\testFormatComment(), LinkerTest\testFormatLinksInComment(), LanguageTest\testFormatNum(), ApiQuerySiteinfoTest\testGeneral(), FileTest\testGenerateBucketsIfNeeded(), DifferenceEngineTest\testGenerateContentDiffBody(), DifferenceEngineTest\testGenerateTextDiffBody(), OutputPageTest\testGetCacheVaryCookies(), WikitextContentHandlerTest\testGetChangeTag(), ContentHandlerTest\testGetChangeTag(), ContentHandlerTest\testGetContentText_NonTextContent_fail(), ContentHandlerTest\testGetContentText_NonTextContent_ignore(), ContentHandlerTest\testGetContentText_NonTextContent_serialize(), ContentHandlerTest\testGetContentText_Null(), ContentHandlerTest\testGetContentText_TextContent(), DifferenceEngineTest\testGetDiffBody(), TitleTest\testGetFragmentForURL(), WebRequestTest\testGetIP(), WebRequestTest\testGetIpLackOfRemoteAddrThrowAnException(), ResourceLoaderTest\testGetLoadScript(), ResourceLoaderSkinModuleTest\testGetLogoData(), ResourceLoaderStartUpModuleTest\testGetModuleRegistrations(), TitleTest\testGetPageViewLanguage(), DeferredUpdatesTest\testGetPendingUpdates(), HttpTest\testGetProxy(), SpecialShortpagesTest\testGetQueryInfoRespectsContentNS(), CssContentTest\testGetRedirectTarget(), JavaScriptContentTest\testGetRedirectTarget(), WikiPageDbTestBase\testGetRedirectTarget(), MediaWiki\Session\ImmutableSessionProviderWithCookieTest\testGetSessionIdFromCookie(), ChangeTagsTest\testGetSoftwareTags(), ParserOutputTest\testGetText(), MediaWiki\Tests\EditPage\TextboxBuilderTest\testGetTextboxProtectionCSSClasses(), FileTest\testGetThumbnailBucket(), ResourceLoaderStartUpModuleTest\testGetVersionHash_varyConfig(), WikiMapTest\testGetWiki(), ApiLoginTest\testGoodPass(), GlobalVarConfigTest\testHas(), RepoGroupTest\testHasForeignRepoNegative(), RequestContextTest\testImportScopedSession(), MessageTest\testInContentLanguageOverride(), RevisionDbTestBase\testInsertOn_exceptionOnIncomplete(), RevisionDbTestBase\testInsertOn_success(), ActorMigrationTest\testInsertUserIdentity(), ImportLogFormatterTest\testInterwikiLogDatabaseRows(), ApiQuerySiteinfoTest\testInterwikiMap(), ApiQueryUserContribsTest\testInterwikiUser(), SanitizerTest\testInvalidFragmentThrows(), UserTest\testIpBlockCookieIgnoredWhenUserLoggedIn(), UserTest\testIpBlockCookieNotSet(), UserTest\testIpBlockCookieSet(), LocalIdLookupTest\testIsAttachedShared(), MWExceptionTest\testisCommandLine(), TextContentTest\testIsCountable(), WikiPageDbTestBase\testIsCountable(), RecentChangeTest\testIsInRCLifespan(), UserTest\testIsLocallyBlockedProxy(), UserTest\testIsPingLimitable(), TitleTest\testIsRawHtmlMessage(), MergeHistoryTest\testIsValidMerge(), MovePageTest\testIsValidMove(), TitleTest\testIsValidMoveOperation(), MWExceptionTest\testJsonserializeexceptionBacktracingDisabled(), MWExceptionTest\testJsonserializeexceptionBacktracingEnabled(), MWExceptionTest\testJsonserializeexceptionKeys(), ApiQuerySiteinfoTest\testLanguageVariantsDisabled(), LinkerTest\testLinkBeginHook(), LinkerTest\testLinkEndHook(), ChangeTagsTest\testListExplicitlyDefinedTagsNew(), ChangeTagsTest\testListExplicitlyDefinedTagsOld(), ChangeTagsTest\testListExplicitlyDefinedTagsWriteBoth(), MediaWiki\Auth\UserDataAuthenticationRequestTest\testLoadFromSubmission(), RevisionTest\testLoadFromTitle(), BotPasswordTest\testLogin(), ResourceLoaderTest\testMakeLoaderImplementScript(), ResourceLoaderTest\testMakeModuleResponseConcat(), CssContentHandlerTest\testMakeRedirectContent(), JavaScriptContentHandlerTest\testMakeRedirectContent(), OutputPageTest\testMakeResourceLoaderLink(), ShellTest\testMakeScriptCommand(), UploadBaseTest\testMaxUploadSize(), MessageTest\testMessageAsParam(), ExifRotationTest\testMetadataAutoRotate(), ExifRotationTest\testMetadataAutoRotateUnsupported(), ExifRotationTest\testMetadataNoAutoRotate(), ChangeTagsTest\testModifyDisplayQuery(), BitmapMetadataHandlerTest\testMultilingualCascade(), ApiQuerySiteinfoTest\testNamespaces(), ObjectCacheTest\testNewAnythingAccel(), ObjectCacheTest\testNewAnythingHash(), ObjectCacheTest\testNewAnythingNoAccel(), ObjectCacheTest\testNewAnythingNoAccelNoDb(), ParserOptionsTest\testNewCanonical(), DatabaseLogEntryTest\testNewFromId(), MailAddressTest\testNewFromUser(), GlobalVarConfigTest\testNewInstance(), MediaWiki\Auth\TemporaryPasswordAuthenticationRequestTest\testNewRandom(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewRevisionFromArchiveRow_legacyEncoding(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewRevisionFromRow_anonEdit_legacyEncoding(), SanitizerTest\testNoPrimaryFragmentModeThrows(), SanitizerTest\testNoPrimaryFragmentModeThrows2(), LanguageArTest\testNormalize(), LanguageMlTest\testNormalize(), MediaWikiSiteTest\testNormalizePageTitle(), RCFeedIntegrationTest\testNotify(), ApiFormatBaseTest\testNullMimeType(), LinksUpdateTest\testOnAddingAndRemovingCategory_recentChangesRowIsAdded(), LinksUpdateTest\testOnAddingAndRemovingCategoryToTemplates_embeddingPagesAreIgnored(), ParserOptionsTest\testOptionsHash(), OutputPageTest\testParserOutputHooks(), MediaWiki\Session\ImmutableSessionProviderWithCookieTest\testPersistSession(), ApiMoveTest\testPingLimiter(), JpegPixelFormatTest\testPixelFormatRendering(), ResourceLoaderModuleTest\testPlaceholderize(), MediaWikiTest\testPostSendJobDoesNotSetCookie(), ResourceLoaderSkinModuleTest\testPreloadLinkHeaders(), OutputPageTest\testPreloadLinkHeaders(), DeferredUpdatesTest\testPresendAddOnPostsendRun(), ApiEditPageTest\testProhibitedAnonymousEdit(), ApiEditPageTest\testProhibitedChangeContentModel(), CdnCacheUpdateTest\testPurgeMergeWeb(), ContribsPagerTest\testQueryableRanges(), MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProviderTest\testRangeBlock(), MessageTest\testRawHtmlInMsg(), ChangesListSpecialPageTest\testRcHidebyothersFilter(), ChangesListSpecialPageTest\testRcHidemyselfFilter(), ChangesListSpecialPageTest\testRcHidepatrolledDisabledFilter(), ChangesListSpecialPageTest\testRcHideunpatrolledDisabledFilter(), GlobalTest\testReadOnlyGlobalChange(), ResourceLoaderStartUpModuleTest\testRegistrationsMinified(), MessageCacheTest\testReplaceCache(), ErrorPageErrorTest\testReport(), SideBarTest\testRespectExternallinktarget(), SideBarTest\testRespectWgnofollowlinks(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionGetArchiveQueryInfo(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionGetQueryInfo(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionSelectArchiveFields(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionSelectFields(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionStoreGetArchiveQueryInfo(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionStoreGetQueryInfo(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionStoreGetSlotsQueryInfo(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionUserJoinCond(), ApiQuerySiteinfoTest\testRightsInfo(), ExifRotationTest\testRotationRenderingNoAutoRotate(), ClearUserWatchlistJobTest\testRun(), MediaWiki\Tests\Maintenance\PopulateChangeTagDefTest\testRun(), DeferredUpdatesTest\testRunOuterScopeUpdate(), MediaWiki\Tests\Maintenance\PopulateChangeTagDefTest\testRunUpdateHitCountMigrationNew(), MediaWiki\Tests\Maintenance\PopulateChangeTagDefTest\testRunUpdateHitCountMigrationWriteBoth(), DeferredUpdatesTest\testRunUpdateTransactionScope(), SpecialSearchTest\testSearchTermIsNotExpanded(), MediaWiki\Session\PHPSessionHandlerTest\testSessionHandling(), DifferenceEngineTest\testSetContent(), MediaWikiTestCaseTest\testSetGlobalsAreRestoredOnTearDown(), MediaWikiTestCaseTest\testSetNonExistentGlobalsAreUnsetOnTearDown(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testSetPasswordResetFlag(), MediaWiki\Logger\LegacyLoggerTest\testShouldEmit(), UserTest\testSoftBlockRanges(), ApiQueryUserContribsTest\testSorting(), SpecialSearchTest\testSubPageRedirect(), JpegTest\testSwappingICCProfile(), UploadStashTest\testT31408(), SpecialPreferencesTest\testT43337(), ChangeTagsTest\testTagUsageStatisticsNewBackend(), ChangeTagsTest\testTagUsageStatisticsNewMigrationOldBackedn(), ChangeTagsTest\testTagUsageStatisticsOldBackend(), SideBarTest\testTestAttributesAssertionHelper(), ApiQueryTest\testTitlePartToKey(), ApiQueryTest\testTitlesGetNormalized(), ApiEditPageTest\testTooBigEdit(), MailAddressTest\testToString(), OutputPageTest\testTransformResourcePath(), ApiUnblockTest\testUnblockWithTag(), ApiUnblockTest\testUnblockWithTagNewBackend(), ImportTest\testUnknownUserHandling(), ContribsPagerTest\testUnqueryableRanges(), ApiLoginTest\testUnsupportedAuthResponseType(), LinksUpdateTest\testUpdate_categorylinks(), LinksUpdateTest\testUpdate_langlinks(), LinksUpdateTest\testUpdate_page_props_without_sortkey(), EditPageTest\testUpdatePage(), EditPageTest\testUpdatePageTrx(), JavaScriptContentTest\testUpdateRedirect(), ChangeTagsTest\testUpdateTagsMigrationOld(), ChangeTagsTest\testUpdateTagsMigrationWriteBoth(), ApiUploadTest\testUploadChunks(), ApiUploadTest\testUploadStash(), MWExceptionTest\testUseMessageCache(), MWExceptionTest\testUseOutputPage(), TimeAdjustTest\testUserAdjust(), TitlePermissionTest\testUserBlock(), RevisionDbTestBase\testUserCan(), RevisionDbTestBase\testUserCanBitfield(), ApiQuerySiteinfoTest\testUserGroups(), LinkerTest\testUserLink(), ResourceLoaderModuleTest\testValidateScriptFile(), WfExpandUrlTest\testWfExpandUrl(), TitleTest\testWgWhitelistReadRegexp(), ApiUserrightsTest\testWithTag(), ApiUserrightsTest\testWithTagNewBackend(), AutoLoaderTest\testWrongCaseClass(), AutoLoaderTest\testWrongCaseSerializedClass(), and GlobalTest\wfWikiID().

◆ setService()

MediaWikiTestCase::setService (   $name,
  $object 
)
protected

Sets a service, maintaining a stashed version of the previous service to be restored in tearDown.

Since
1.27
Parameters
string$name
object$object

Definition at line 646 of file MediaWikiTestCase.php.

References $name, doSetMwGlobals(), and use.

Referenced by ApiMainTest\doTestCheckMaxLag(), ApiOpenSearchTest\replaceSearchEngine(), ApiOpenSearchTest\replaceSearchEngineConfig(), TitleTest\secureAndSplitGlobals(), setContentLang(), ApiParseTest\setupSkin(), RevisionTest\testCompressRevisionTextUtf8Gzip(), ApiQuerySiteinfoTest\testDbReplLagInfo(), RevisionTest\testDecompressRevisionText(), ExternalStoreTest\testExternalFetchFromURL_noExternalStores(), ExternalStoreTest\testExternalFetchFromURL_someExternalStore(), WebRequestTest\testGetIP(), WebRequestTest\testGetIpLackOfRemoteAddrThrowAnException(), MediaWiki\Tests\Revision\RenderedRevisionTest\testGetRevisionParserOutput_incompleteWithId(), RevisionTest\testGetRevisionText_external_noOldId(), RevisionTest\testGetRevisionText_external_oldId(), RevisionTest\testGetRevisionWithGzipAndLegacyEncoding(), RevisionTest\testGetRevisionWithLegacyEncoding(), MediaWiki\Tests\Revision\RevisionStoreTest\testGetTitle_correctFallbackAndthrowsExceptionAfterFallbacks(), MediaWiki\Tests\Revision\RevisionStoreTest\testGetTitle_successFromPageId(), MediaWiki\Tests\Revision\RevisionStoreTest\testGetTitle_successFromPageIdOnFallback(), MediaWiki\Tests\Revision\RevisionStoreTest\testGetTitle_successFromRevId(), MediaWiki\Tests\Revision\RevisionStoreTest\testGetTitle_successFromRevIdOnFallback(), ExternalUserNamesTest\testGetUserLinkTitle(), WfThumbIsStandardTest\testIsStandard(), SiteStatsTest\testJobsCountGetCached(), ResourceLoaderTest\testMeasureResponseTime(), MultiHttpClientTest\testMultiHttpClientHeaders(), MultiHttpClientTest\testMultiHttpClientMultipleFailure(), MultiHttpClientTest\testMultiHttpClientMultipleSuccess(), MultiHttpClientTest\testMultiHttpClientSingleFailure(), MultiHttpClientTest\testMultiHttpClientSingleSuccess(), RevisionDbTestBase\testNewFromArchiveRow(), RevisionDbTestBase\testNewKnownCurrent(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewMutableRevisionFromArray_legacyEncoding(), ParserMethodsTest\testRevisionAccess(), and MediaWikiTestCaseTest\testSetService().

◆ 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

Definition at line 2291 of file MediaWikiTestCase.php.

References $handler, and mergeMwGlobalArrayValue().

Referenced by MediaWiki\Auth\AuthManagerTest\hook(), SpecialWatchlistTest\setUp(), ParserOptionsTest\setUp(), ParserOptionsTest\testAllCacheVaryingOptions(), ApiEditPageTest\testAppendInMediaWikiNamespaceWithSerializationError(), ApiEditPageTest\testAppendWithNonTextContentHandler(), ArticleViewTest\testArticleAfterFetchContentObjectHook(), ArticleViewTest\testArticleContentViewCustomHook(), ArticleViewTest\testArticleRevisionViewCustomHook(), ArticleViewTest\testArticleViewHeaderHook(), ApiLoginTest\testBotPasswordLocked(), ApiMainTest\testCheckExecutePermissionHookAbort(), ContentHandlerTest\testDataIndexFields(), ApiDeleteTest\testDeleteAbortedByHook(), ApiEditPageTest\testEditAbortedByEditPageHookWithNoResult(), ApiEditPageTest\testEditAbortedByEditPageHookWithResult(), ApiEditPageTest\testEditAbortedByHook(), ApiEditPageTest\testEditAbortedByHookWithCustomOutput(), ApiParseTest\testEffectiveLangLinks(), OutputPageTest\testGetCacheVaryCookies(), ContentHandlerTest\testGetContentModelsHook(), DefaultPreferencesFactoryTest\testGetForm(), ApiQuerySiteinfoTest\testGetHooks(), SpecialShortpagesTest\testGetQueryInfoRespectsContentNS(), ContentHandlerTest\testGetSlotDiffRenderer_hook(), ShellTest\testMakeScriptCommand(), ApiParseTest\testModules(), ApiLoginTest\testNoSameOriginSecurity(), ParserOptionsTest\testOptionsHash(), SearchEngineTest\testParseNamespacePrefix(), MediaWikiTest\testPostSendJobDoesNotSetCookie(), DefaultPreferencesFactoryTest\testPreferencesFormPreSaveHookHasCorrectData(), SearchEngineTest\testSearchIndexFields(), ArticleViewTest\testShowMissingArticleHook(), ApiQuerySiteinfoTest\testStatistics(), ParserOptionsTest\testUsedLazyOptionsInHash(), AbstractChangesListSpecialPageTestCase\testValidateOptions(), and ArticleViewTest\testViewNonText().

◆ setUp()

MediaWikiTestCase::setUp ( )
protected

◆ setupAllTestDBs()

MediaWikiTestCase::setupAllTestDBs ( )

Set up all test DBs.

Definition at line 1420 of file MediaWikiTestCase.php.

References $wgDBprefix, CloneDatabase\changePrefix(), and dbPrefix().

Referenced by run().

◆ setUpBeforeClass()

static MediaWikiTestCase::setUpBeforeClass ( )
static

Definition at line 162 of file MediaWikiTestCase.php.

◆ setupDatabaseWithTestPrefix()

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

Setups a database with cloned tables using 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.

Parameters
IMaintainableDatabase$dbDatabase to use
string | null$prefixPrefix to use for test tables. If not given, the prefix is determined automatically for $db.
Returns
bool True if tables were cloned, false if only the prefix was changed

Definition at line 1382 of file MediaWikiTestCase.php.

References Wikimedia\Rdbms\IDatabase\getType(), and Wikimedia\Rdbms\IDatabase\tablePrefix().

◆ setupExternalStoreTestDBs()

static MediaWikiTestCase::setupExternalStoreTestDBs (   $testPrefix = null)
staticprotected

Clones the External Store database(s) for testing.

Parameters
string | null$testPrefixPrefix for test tables. Will be determined automatically if not given.

Definition at line 1494 of file MediaWikiTestCase.php.

References as.

◆ setUpSchema()

MediaWikiTestCase::setUpSchema ( IMaintainableDatabase  $db)
private

Applies the schema overrides returned by getSchemaOverrides(), after undoing any previously applied schema overrides.

Called once per test class, just before addDataOnce().

Definition at line 1621 of file MediaWikiTestCase.php.

References as, dropMockTables(), ensureMockDatabaseConnection(), getSchemaOverrides(), listOriginalTables(), mungeSchemaUpdateQuery(), Wikimedia\Rdbms\IMaintainableDatabase\sourceFile(), and undoSchemaOverrides().

Referenced by run().

◆ 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

Definition at line 1460 of file MediaWikiTestCase.php.

References Wikimedia\Rdbms\IDatabase\getType(), Wikimedia\Rdbms\Database\query(), Hooks\run(), and Wikimedia\Rdbms\Database\tablePrefix().

Referenced by ParserTestTopLevelSuite\setUp().

◆ 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
Deprecated:
since 1.32, use setMwGlobals() and don't alter globals directly

Definition at line 813 of file MediaWikiTestCase.php.

References doStashMwGlobals(), and wfDeprecated().

Referenced by MediaWikiTestCaseTest\testStashedGlobalsAreRestoredOnTearDown().

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

Definition at line 2099 of file MediaWikiTestCase.php.

References as.

◆ tearDown()

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

This is called by phpunit/bootstrap.php after the last test.

Since
1.21

Definition at line 1351 of file MediaWikiTestCase.php.

References $type, $wgJobClasses, as, CloneDatabase\changePrefix(), Hooks\run(), 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).

Definition at line 631 of file MediaWikiTestCase.php.

References class.

◆ truncateTable()

MediaWikiTestCase::truncateTable (   $tableName,
IDatabase  $db = null 
)
protected

Empties the given table and resets any auto-increment counters.

Will also purge caches associated with some well known tables. If the table is not know, this method just returns.

Parameters
string$tableName
IDatabase | null$db

Definition at line 1810 of file MediaWikiTestCase.php.

References $db, Wikimedia\Rdbms\Database\delete(), SiteStatsInit\doPlaceholderInit(), Wikimedia\Rdbms\IDatabase\getType(), Wikimedia\Rdbms\Database\query(), Wikimedia\Rdbms\Database\tableExists(), and Wikimedia\Rdbms\Database\tableName().

Referenced by resetDB(), and MediaWiki\Tests\Storage\NameTableStoreTest\testGetAndAcquireId().

◆ undoSchemaOverrides()

MediaWikiTestCase::undoSchemaOverrides ( IMaintainableDatabase  $db,
  $oldOverrides 
)
private

Undoes the specified schema overrides.

Called once per test class, just before addDataOnce().

Parameters
IMaintainableDatabase$db
array$oldOverrides

Definition at line 1593 of file MediaWikiTestCase.php.

References dropMockTables(), ensureMockDatabaseConnection(), listOriginalTables(), and recloneMockTables().

Referenced by setUpSchema().

◆ unprefixTable()

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

Definition at line 1838 of file MediaWikiTestCase.php.

◆ usesTemporaryTables()

MediaWikiTestCase::usesTemporaryTables ( )
Since
1.21
Returns
bool

Definition at line 458 of file MediaWikiTestCase.php.

◆ wfResetOutputBuffersBarrier()

static MediaWikiTestCase::wfResetOutputBuffersBarrier (   $buffer)
static

Used as a marker to prevent wfResetOutputBuffers from breaking PHPUnit.

Parameters
string$buffer
Returns
string

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

Definition at line 46 of file MediaWikiTestCase.php.

Referenced by SpecialPageFactoryTest\testGetAliasListRecursion(), DeprecatedGlobalTest\testLazyLoad(), LBFactoryTest\testLBFactoryMultiRoundCallbacks(), MediaWiki\Session\SessionManagerTest\testLoadSessionInfoFromStore(), HTMLCheckMatrixTest\testValidateCallsUserDefinedValidationCallback(), and LoadBalancerTest\testWithoutReplica().

◆ $cliArgs

array MediaWikiTestCase::$cliArgs = []
private

The CLI arguments passed through from phpunit.php.

Definition at line 121 of file MediaWikiTestCase.php.

◆ $db

Database MediaWikiTestCase::$db
protected

Primary database.

Since
1.18

Definition at line 60 of file MediaWikiTestCase.php.

Referenced by MediaWiki\Tests\Revision\RevisionStoreDbTestBase\getDatabaseMock(), RangeChronologicalPagerTest\getDateRangeCondProvider(), MediaWiki\Tests\Revision\RevisionRendererTest\getMockDatabaseConnection(), MediaWiki\Tests\Storage\NameTableStoreTest\getMockLoadBalancer(), BatchRowUpdateTest\mockDbConsecutiveSelect(), MediaWiki\Tests\Revision\RevisionRendererTest\newRevisionRenderer(), MediaWiki\Tests\Revision\NoContentModelRevisionStoreDbTest\provideGetSlotsQueryInfo(), CommentStoreTest\provideInsertRoundTrip(), ActorMigrationTest\provideInsertRoundTrip(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\provideSlotsQueryInfo(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testDomainCheck(), UserTest\testExperienceLevel(), ReverseChronologicalPagerTest\testGetDateCond(), MediaWiki\Tests\Revision\RevisionStoreTest\testGetTitle_correctFallbackAndthrowsExceptionAfterFallbacks(), MediaWiki\Tests\Revision\RevisionStoreTest\testGetTitle_successFromPageId(), MediaWiki\Tests\Revision\RevisionStoreTest\testGetTitle_successFromPageIdOnFallback(), MediaWiki\Tests\Revision\RevisionStoreTest\testGetTitle_successFromRevId(), MediaWiki\Tests\Revision\RevisionStoreTest\testGetTitle_successFromRevIdOnFallback(), WatchedItemQueryServiceUnitTest\testGetWatchedItemsWithRecentChangeInfo_extension(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testInsertRevisionOn_archive(), LBFactoryTest\testInvalidSelectDB(), RevisionTest\testLoadFromTitle(), DatabaseLogEntryTest\testNewFromId(), RevisionDbTestBase\testNewKnownCurrent(), RevisionDbTestBase\testNewKnownCurrent_returnsFalseWhenTitleDoesntExist(), RevisionDbTestBase\testNewKnownCurrent_withPageId(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewRevisionFromArchiveRow_getArchiveQueryInfo(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewRevisionFromArchiveRow_legacyEncoding(), LBFactoryTest\testNiceDomains(), BatchRowUpdateTest\testReaderBasicIterate(), BatchRowUpdateTest\testReaderSelectConditionsMultiplePrimaryKeys(), BatchRowUpdateTest\testReaderSetFetchColumns(), LBFactoryTest\testTrickyDomain(), ImportTest\testUnknownUserHandling(), BatchRowUpdateTest\testWriterBasicFunctionality(), and truncateTable().

◆ $dbSetup

MediaWikiTestCase::$dbSetup = false
staticprivate

Definition at line 70 of file MediaWikiTestCase.php.

◆ $iniSettings

array MediaWikiTestCase::$iniSettings = []
private

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

See also
setIniSettings()

Definition at line 109 of file MediaWikiTestCase.php.

◆ $localServices

MediaWikiServices MediaWikiTestCase::$localServices
private

The local service locator, created during setUp().

Definition at line 32 of file MediaWikiTestCase.php.

◆ $loggers

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

Holds original loggers which have been replaced by setLogger()

Definition at line 115 of file MediaWikiTestCase.php.

◆ $mwGlobals

array MediaWikiTestCase::$mwGlobals = []
private

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

See also setMwGlobals().

Definition at line 94 of file MediaWikiTestCase.php.

◆ $mwGlobalsToUnset

array MediaWikiTestCase::$mwGlobalsToUnset = []
private

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

See also setMwGlobals().

Definition at line 101 of file MediaWikiTestCase.php.

◆ $oldTablePrefix

MediaWikiTestCase::$oldTablePrefix = ''
staticprivate

Definition at line 71 of file MediaWikiTestCase.php.

◆ $originalServices

MediaWikiServices null MediaWikiTestCase::$originalServices
staticprivate

The original service locator.

This is overridden during setUp().

Definition at line 26 of file MediaWikiTestCase.php.

◆ $overriddenServices

string [] MediaWikiTestCase::$overriddenServices = []
private

Holds a list of services that were overridden with setService().

Used for printing an error if overrideMwServices() overrides a service that was previously set.

Definition at line 128 of file MediaWikiTestCase.php.

◆ $phpErrorLevel

int MediaWikiTestCase::$phpErrorLevel
private

Original value of PHP's error_reporting setting.

Definition at line 78 of file MediaWikiTestCase.php.

◆ $reuseDB

MediaWikiTestCase::$reuseDB = false
staticprivate

Definition at line 69 of file MediaWikiTestCase.php.

◆ $schemaOverrideDefaults

MediaWikiTestCase::$schemaOverrideDefaults
staticprivate
Initial value:
= [
'scripts' => []

Definition at line 1561 of file MediaWikiTestCase.php.

◆ $supportedDBs

array MediaWikiTestCase::$supportedDBs
protected
Initial value:
= [
'mysql',
'sqlite',
'postgres',
'oracle'
]
Since
1.18

Definition at line 140 of file MediaWikiTestCase.php.

Referenced by checkDbIsSupported().

◆ $tablesUsed

array MediaWikiTestCase::$tablesUsed = []
protected
Since
1.19

Definition at line 66 of file MediaWikiTestCase.php.

◆ $tmpFiles

array MediaWikiTestCase::$tmpFiles = []
private

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

Definition at line 86 of file MediaWikiTestCase.php.

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

◆ $users

◆ $useTemporaryTables

MediaWikiTestCase::$useTemporaryTables = true
staticprivate

Definition at line 68 of file MediaWikiTestCase.php.

◆ DB_PREFIX

const MediaWikiTestCase::DB_PREFIX = 'unittest_'

Table name prefixes.

Oracle likes it shorter.

Definition at line 133 of file MediaWikiTestCase.php.

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

◆ ORA_DB_PREFIX

const MediaWikiTestCase::ORA_DB_PREFIX = 'ut_'

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