MediaWiki REL1_33
|
Inherits PHPUnit\Framework\TestCase.
Inherited by AbstractChangesListSpecialPageTestCase, ActionTest, ApiContinuationManagerTest, ApiFormatTestBase, ApiMessageTest, ApiModuleManagerTest, ApiOpenSearchTest, ApiPrefixUniquenessTest, ApiResultTest, ApiStructureTest, ApiUsageExceptionTest, ArrayDiffFormatterTest, ArticleTest, ArticleViewTest, AutoLoaderStructureTest, AutoLoaderTest, AutopromoteTest, BadTitleErrorTest, BagOStuffTest, BaseBlacklistTest, BatchRowUpdateTest, BitmapMetadataHandlerTest, BitmapScalingTest, BlockListPagerTest, BotPasswordTest, CSSMinTest, CachingSiteStoreTest, CaptchaPreAuthenticationProviderTest, CaptchaTest, CategoryMembershipChangeJobTest, CategoryTest, CdnCacheUpdateTest, CentralIdLookupTest, ChangeTagsTest, ChangesListBooleanFilterGroupTest, ChangesListBooleanFilterTest, ChangesListFilterGroupTest, ChangesListFilterTest, ChangesListStringOptionsFilterGroupTest, ClassicInterwikiLookupTest, ClearUserWatchlistJobTest, ConfigFactoryTest, ContentHandlerSanityTest, ContentHandlerTest, ContentSecurityPolicyTest, ContribsPagerTest, CoreParserFunctionsTest, CustomUppercaseCollationTest, DBSiteStoreTest, DatabaseIntegrationTest, DatabaseLogEntryTest, DatabasePostgresTest, DatabaseSqliteTest, DefaultPreferencesFactoryTest, DeferredUpdatesTest, DeprecatedGlobalTest, DeprecationHelperTest, DiffHistoryBlobTest, DiffOpTest, DiffTest, DifferenceEngineTest, DummyExtensionsTest, ErrorPageErrorTest, ExifTest, ExpressionTest, ExtensionJsonValidatorTest, ExtensionProcessorTest, ExtensionRegistryTest, ExternalStoreTest, ExternalUserNamesTest, ExtraParserTest, FauxResponseTest, FileBackendDBRepoWrapperTest, FileBackendTest, FileRepoTest, FiltersTest, ForeignTitleTest, FormOptionsInitializationTest, FormOptionsTest, FormatJsonTest, GIFMetadataExtractorTest, GadgetTest, GitInfoTest, GlobalTest, GlobalVarConfigTest, GlobalWithDBTest, GuzzleHttpRequestTest, HTMLAutoCompleteSelectFieldTest, HTMLCheckMatrixTest, HTMLFormTest, HashConfigTest, HashSiteStoreTest, HooksTest, HtmlTest, HttpErrorTest, HttpTest, IPTCTest, ImageListPagerTest, ImportLinkCacheIntegrationTest, InstallDocFormatterTest, InterwikiLookupAdapterTest, InterwikiTest, JobQueueTest, JobTest, JpegMetadataExtractorTest, JsonContentHandlerTest, LBFactoryTest, LanguageClassesTestCase, LicensesTest, ListToggleTest, LoadBalancerTest, LocalFileTest, LocalIdLookupTest, LocalisationCacheTest, MWCryptHKDFTest, MWDebugTest, MWExceptionHandlerTest, MWExceptionTest, MWGrantsTest, MWNamespaceTest, MagicVariableTest, MagicWordFactoryTest, MailAddressTest, MediaHandlerTest, MediaWiki\Auth\AbstractAuthenticationProviderTest, MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest, MediaWiki\Auth\AbstractPreAuthenticationProviderTest, MediaWiki\Auth\AbstractPrimaryAuthenticationProviderTest, MediaWiki\Auth\AbstractSecondaryAuthenticationProviderTest, MediaWiki\Auth\AuthManagerTest, MediaWiki\Auth\AuthenticationRequestTest, MediaWiki\Auth\AuthenticationRequestTestCase, MediaWiki\Auth\AuthenticationResponseTest, MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProviderTest, MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProviderTest, 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\Block\Restriction\RestrictionTestCase, MediaWiki\Tests\EditPage\TextboxBuilderTest, MediaWiki\Tests\Maintenance\BaseDumpTest, MediaWiki\Tests\Maintenance\FetchTextTest, MediaWiki\Tests\Maintenance\MaintenanceBaseTestCase, MediaWiki\Tests\Revision\FallbackSlotRoleHandlerTest, MediaWiki\Tests\Revision\MainSlotRoleHandlerTest, 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\Revision\SlotRoleHandlerTest, MediaWiki\Tests\Revision\SlotRoleRegistryTest, 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, NaiveForeignTitleFactoryTest, NaiveImportTitleFactoryTest, NamespaceAwareForeignTitleFactoryTest, NamespaceImportTitleFactoryTest, NoWriteWatchedItemStoreUnitTest, ObjectCacheTest, OracleInstallerTest, OutputPageTest, PNGMetadataExtractorTest, PageArchiveTestBase, ParserFactoryTest, ParserOptionsTest, ParserPreloadTest, PasswordFactoryTest, PasswordPolicyChecksTest, PasswordPolicyStructureTest, PasswordResetTest, PasswordTest, PasswordTestCase, PathRouterTest, PoolCounterTest, PoolWorkArticleViewTest, PreprocessorTest, QueryAllSpecialPagesTest, QuestyCaptchaTest, RCFeedIntegrationTest, RESTBagOStuffTest, ReadOnlyErrorTest, ReadOnlyModeTest, RecentChangeTest, RefreshLinksJobTest, RefreshLinksPartitionTest, ReleaseNotesTest, RemexDriverTest, ReplicatedBagOStuffTest, RepoGroupTest, RequestContextTest, ResourceLoaderSkinModuleTest, ResourceLoaderTestCase, ResourcesTest, RevisionDbTestBase, RevisionTest, SVGMetadataExtractorTest, SearchIndexFieldTest, SearchResultSetTest, SearchUpdateTest, ServiceWiringTest, ShellTest, SiteConfigurationTest, SiteListTest, SiteStatsTest, SiteStatsUpdateTest, SiteTest, SkinFactoryTest, SkinTemplateTest, SkinTest, SpamBlacklistTest, SpecialMIMESearchTest, SpecialMyLanguageTest, SpecialPageAliasTest, SpecialPageFactoryTest, SpecialPageFatalTest, SpecialPageTest, SpecialPageTestBase, SpecialPreferencesTest, SpecialRedirectTest, SpecialSearchTest, SpecialShortpagesTest, SpecialUploadTest, StoreBatchTest, StripStateTest, StructureTest, SubpageImportTitleFactoryTest, SwiftFileBackendTest, TagHooksTest, TemplateParserTest, TextSlotDiffRendererTest, ThrottledErrorTest, TidyTest, TiffTest, TitleBlacklistPreAuthenticationProviderTest, TitleTest, TitleValueTest, UncategorizedCategoriesPageTest, UploadBaseTest, UploadStashTest, UserArrayFromResultTest, UserGroupMembershipTest, UserNotLoggedInTest, UserPasswordPolicyTest, UserTest, ViewActionTest, 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.
Public Member Functions | |
__construct ( $name=null, array $data=[], $dataName='') | |
__destruct () | |
addDBData () | |
Stub. | |
addDBDataOnce () | |
Stub. | |
copyTestData (IDatabase $source, IDatabase $target) | |
Copy test data from one database connection to another. | |
dbPrefix () | |
getCliArg ( $offset) | |
hideDeprecated ( $function) | |
Don't throw a warning if $function is deprecated and called later. | |
needsDB () | |
run (PHPUnit_Framework_TestResult $result=null) | |
setCliArg ( $offset, $value) | |
setContentLang ( $lang) | |
setGroupPermissions ( $newPerms, $newKey=null, $newValue=null) | |
Alters $wgGroupPermissions for the duration of the test. | |
setupAllTestDBs () | |
Set up all test DBs. | |
setUserLang ( $lang) | |
testMediaWikiTestCaseParentSetupCalled () | |
Make sure MediaWikiTestCase extending classes have called their parent setUp method. | |
usesTemporaryTables () | |
Static Public Member Functions | |
static | getMutableTestUser ( $groups=[]) |
Convenience method for getting a mutable test user. | |
static | getTestPrefixFor (IDatabase $db) |
static | getTestSysop () |
Convenience method for getting an immutable admin test user. | |
static | getTestUser ( $groups=[]) |
Convenience method for getting an immutable test user. | |
static | installMockMwServices (Config $configOverrides=null) |
Creates a new "mock" MediaWikiServices instance, and installs it. | |
static | listTables (IMaintainableDatabase $db) |
static | prepareServices (Config $bootstrapConfig) |
static | resetNonServiceCaches () |
Resets some non-service singleton instances and other static caches. | |
static | restoreMwServices () |
Restores the original, non-mock MediaWikiServices instance. | |
static | setUpBeforeClass () |
static | setupTestDB (IMaintainableDatabase $db, $prefix) |
Creates an empty skeleton of the wiki database by cloning its structure to equivalent tables using the given $prefix. | |
static | teardownTestDB () |
Restores MediaWiki to using the table set (table prefix) it was using before setupTestDB() was called. | |
static | wfResetOutputBuffersBarrier ( $buffer) |
Used as a marker to prevent wfResetOutputBuffers from breaking PHPUnit. | |
Public Attributes | |
const | DB_PREFIX = 'unittest_' |
Table name prefixes. | |
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. | |
assertArrayEquals (array $expected, array $actual, $ordered=false, $named=false) | |
Assert that two arrays are equal. | |
assertFileContains ( $fileName, $actualData, $createIfMissing=false, $msg='') | |
Check whether file contains given data. | |
assertHTMLEquals ( $expected, $actual, $msg='') | |
Put each HTML element on its own line and then equals() the results. | |
assertSelect ( $table, $fields, $condition, array $expectedRows, array $options=[], array $join_conds=[]) | |
Asserts that the given database query yields the rows given by $expectedRows. | |
assertType ( $type, $actual, $message='') | |
Asserts the type of the provided value. | |
assertTypeOrValue ( $type, $actual, $value=false, $message='') | |
Asserts that the provided variable is of the specified internal type or equals the $value argument. | |
checkDbIsSupported () | |
checkPHPExtension ( $extName) | |
Check if $extName is a loaded PHP extension, will skip the test whenever it is not loaded. | |
editPage ( $pageName, $text, $summary='', $defaultNs=NS_MAIN) | |
Edits or creates a page/revision. | |
ensureMockDatabaseConnection (IDatabase $db) | |
getDefaultWikitextNS () | |
Returns the ID of a namespace that defaults to Wikitext. | |
getExistingTestPage ( $title=null) | |
Returns a WikiPage representing an existing page. | |
getNewTempDirectory () | |
obtains a new temporary directory | |
getNewTempFile () | |
Obtains a new temporary file name. | |
getNonexistingTestPage ( $title=null) | |
Returns a WikiPage representing a non-existing page. | |
getSchemaOverrides (IMaintainableDatabase $db) | |
Stub. | |
insertPage ( $pageName, $text='Sample page for unit test.', $namespace=null, User $user=null) | |
Insert a new page. | |
isTestInDatabaseGroup () | |
isWikitextNS ( $ns) | |
Returns true if the given namespace defaults to Wikitext according to $wgNamespaceContentModels. | |
markTestSkippedIfDbType ( $type) | |
Skip the test if using the specified database type. | |
markTestSkippedIfNoDiff3 () | |
Check, if $wgDiff3 is set and ready to merge Will mark the calling test as skipped, if not ready. | |
mergeMwGlobalArrayValue ( $name, $values) | |
Merges the given values into a MW global array variable. | |
objectAssociativeSort (array &$array) | |
Does an associative sort that works for objects. | |
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. | |
revisionDelete ( $rev, array $value=[Revision::DELETED_TEXT=> 1], $comment='') | |
Revision-deletes a revision. | |
setIniSetting ( $name, $value) | |
Set an ini setting for the duration of the test. | |
setLogger ( $channel, LoggerInterface $logger) | |
Sets the logger for a specified channel, for the duration of the test. | |
setMwGlobals ( $pairs, $value=null) | |
Sets a global, maintaining a stashed version of the previous global to be restored in tearDown. | |
setService ( $name, $object) | |
Sets a service, maintaining a stashed version of the previous service to be restored in tearDown. | |
setTemporaryHook ( $hookName, $handler) | |
Create a temporary hook handler which will be reset by tearDown. | |
setUp () | |
stashMwGlobals ( $globalKeys) | |
Stashes the global, will be restored in tearDown() | |
tearDown () | |
truncateTable ( $tableName, IDatabase $db=null) | |
Empties the given table and resets any auto-increment counters. | |
Static Protected Member Functions | |
static | getExternalStoreDatabaseConnections () |
Gets master database connections for all of the ExternalStoreDB stores configured in $wgDefaultExternalStore. | |
static | isUsingExternalStoreDB () |
Check whether ExternalStoreDB is being used. | |
static | setupDatabaseWithTestPrefix (IMaintainableDatabase $db, $prefix=null) |
Setups a database with cloned tables using the given prefix. | |
static | setupExternalStoreTestDBs ( $testPrefix=null) |
Clones the External Store database(s) for testing. | |
static | stripStringKeys (&$r) |
Utility function for eliminating all string keys from an array. | |
Protected Attributes | |
Database | $db |
Primary database. | |
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. | |
doStashMwGlobals ( $globalKeys) | |
dropMockTables (IMaintainableDatabase $db, array $tables) | |
Drops the given mock tables. | |
listOriginalTables (IMaintainableDatabase $db) | |
Lists all tables in the live database schema, without a prefix. | |
mungeSchemaUpdateQuery ( $cmd) | |
oncePerClass () | |
recloneMockTables (IMaintainableDatabase $db, array $tables) | |
Re-clones the given mock tables to restore them based on the live database schema. | |
resetDB ( $db, $tablesUsed) | |
Empty all tables so they can be repopulated for tests. | |
resetNamespaces () | |
Must be called whenever namespaces are changed, e.g., $wgExtraNamespaces is altered. | |
restoreLoggers () | |
Restores loggers replaced by setLogger(). | |
setUpSchema (IMaintainableDatabase $db) | |
Applies the schema overrides returned by getSchemaOverrides(), after undoing any previously applied schema overrides. | |
undoSchemaOverrides (IMaintainableDatabase $db, $oldOverrides) | |
Undoes the specified schema overrides. | |
Static Private Member Functions | |
static | canShallowCopy ( $value) |
Check if we can back up a value by performing a shallow copy. | |
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. | |
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. | |
array | $cliArgs = [] |
The CLI arguments passed through from phpunit.php. | |
array | $iniSettings = [] |
Holds original values of ini settings to be restored in tearDown(). | |
MediaWikiServices | $localServices |
The local service locator, created during setUp(). | |
LoggerInterface[] | $loggers = [] |
Holds original loggers which have been replaced by setLogger() | |
array | $mwGlobals = [] |
Holds original values of MediaWiki configuration settings to be restored in tearDown(). | |
array | $mwGlobalsToUnset = [] |
Holds list of MediaWiki configuration settings to be unset in tearDown(). | |
string[] | $overriddenServices = [] |
Holds a list of services that were overridden with setService(). | |
int | $phpErrorLevel |
Original value of PHP's error_reporting setting. | |
array | $tmpFiles = [] |
Holds the paths of temporary files/directories created through getNewTempFile, and getNewTempDirectory. | |
Static Private Attributes | |
static | $dbSetup = false |
static | $oldTablePrefix = '' |
static MediaWikiServices null | $originalServices |
The original service locator. | |
static | $reuseDB = false |
static | $schemaOverrideDefaults |
static | $useTemporaryTables = true |
Definition at line 17 of file MediaWikiTestCase.php.
Reimplemented in ApiQueryRecentChangesIntegrationTest, ApiQueryWatchlistIntegrationTest, EnhancedChangesListTest, OldChangesListTest, RCCacheEntryFactoryTest, LinksUpdateTest, JobQueueTest, RefreshLinksPartitionTest, PageArchiveTestBase, WikiPageDbTestBase, and RevisionDbTestBase.
Definition at line 148 of file MediaWikiTestCase.php.
References $data.
MediaWikiTestCase::__destruct | ( | ) |
Definition at line 155 of file MediaWikiTestCase.php.
References and().
|
protected |
Reimplemented in PageArchiveTestBase, WikiPageDbTestBase, MediaWiki\Tests\Revision\RevisionStoreDbTestBase, RevisionDbTestBase, and MediaWiki\Tests\Storage\NameTableStoreTest.
Definition at line 1286 of file MediaWikiTestCase.php.
References and(), SiteStatsInit\doPlaceholderInit(), EDIT_NEW, EDIT_SUPPRESS_RC, and User\resetIdByNameCache().
MediaWikiTestCase::addDBData | ( | ) |
Stub.
Subclasses may override this to prepare the database. Called before every test run (test function or data set).
Reimplemented in BotPasswordTest, LocalIdLookupTest, MediaWiki\Tests\Maintenance\BackupDumperLoggerTest, MediaWiki\Tests\Maintenance\BackupDumperPageTest, and MediaWiki\Tests\Maintenance\TextPassDumperDatabaseTest.
Definition at line 1280 of file MediaWikiTestCase.php.
Referenced by run().
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().
Reimplemented in ApiComparePagesTest, ApiParseTest, ApiQueryBasicTest, ApiQueryContinue2Test, ApiQueryContinueTest, ApiQueryUserContribsTest, GenderCacheTest, MessageCacheTest, CategoryMembershipChangeTest, ContentHandlerTest, LinksUpdateTest, CategoryMembershipChangeJobTest, MergeHistoryTest, PrefixSearchTest, SearchEnginePrefixTest, SearchEngineTest, MediaWiki\Session\BotPasswordSessionProviderTest, SpecialMyLanguageTest, and MediaWiki\Tests\Maintenance\FetchTextTest.
Definition at line 1268 of file MediaWikiTestCase.php.
Referenced by run().
|
protected |
Definition at line 543 of file MediaWikiTestCase.php.
References and(), and array().
Referenced by FileBackendTest\doTestDoOperationsPipeline(), CSSMinTest\testGetMimeType(), and FileBackendTest\testStore().
|
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.
array | $elements |
Definition at line 2049 of file MediaWikiTestCase.php.
References and().
Referenced by SiteTest\instanceProvider(), SiteListTest\siteArrayProvider(), and SiteListTest\siteListProvider().
|
protected |
Assert that two arrays are equal.
By default this means that both arrays need to hold the same set of values. Using additional arguments, order and associated key can also be set as relevant.
array | $expected | |
array | $actual | |
bool | $ordered | If the order of the values should match |
bool | $named | If the keys should match |
Definition at line 2070 of file MediaWikiTestCase.php.
References and(), and objectAssociativeSort().
Referenced by MediaWiki\Tests\Revision\RevisionStoreDbTestBase\assertRevisionRecordsEqual(), BotPasswordTest\testCanonicalizeLoginData(), SpecialWatchlistTest\testFetchOptionsFromRequest(), ChangesListSpecialPageTest\testFilterUserExpLevel(), WikiMapTest\testGetCanonicalServerInfoForAllWikis(), RangeChronologicalPagerTest\testGetDateRangeCond(), SiteListTest\testGetGlobalIdentifiers(), ApiModuleManagerTest\testGetGroups(), ChangesListBooleanFilterGroupTest\testGetJsData(), ChangesListBooleanFilterTest\testGetJsData(), ChangesListStringOptionsFilterGroupTest\testGetJsData(), MediaWiki\Tests\Revision\SlotRoleRegistryTest\testGetKnownRoles(), ApiModuleManagerTest\testGetNames(), ApiModuleManagerTest\testGetNamesWithClasses(), TextContentTest\testGetParserOutput(), UserPasswordPolicyTest\testGetPoliciesForGroups(), UserPasswordPolicyTest\testGetPoliciesForUser(), MediaWiki\Tests\Revision\RevisionSlotsTest\testGetRolesWithDifferentContent(), ChangesListSpecialPageTest\testGetStructuredFilterJsData(), MediaWiki\Session\CookieSessionProviderTest\testGetVaryCookies(), PoolCounterTest\testHashKeyIntoSlots(), WikitextStructureTest\testHeadingsNone(), UserPasswordPolicyTest\testMaxOfPolicies(), ChangeTagsTest\testModifyDisplayQuery(), MediaWiki\Tests\Storage\RevisionSlotsUpdateTest\testModifySlot(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewNullRevision(), StatusTest\testOkAndErrorsGetters(), AbstractChangesListSpecialPageTestCase\testParseParameters(), SiteListTest\testSerialization(), ChangesListFilterTest\testSetAsSupersetOf(), LinksUpdateTest\testUpdate_externallinks(), LinksUpdateTest\testUpdate_pagelinks(), and AbstractChangesListSpecialPageTestCase\testValidateOptions().
|
protected |
Check whether file contains given data.
string | $fileName | |
string | $actualData | |
bool | $createIfMissing | If true, and file does not exist, create it with given data and skip the test. |
string | $msg |
Definition at line 2338 of file MediaWikiTestCase.php.
References and().
Referenced by MediaWiki\Tests\Maintenance\CategoriesRdfTest\testCategoriesDump(), CategoryChangesAsRdfTest\testSparqlUpdate(), and CategoryChangesAsRdfTest\testUpdateTs().
|
protected |
Put each HTML element on its own line and then equals() the results.
Use for nicely formatting of PHPUnit diff output when comparing very simple HTML
string | $expected | HTML on oneline |
string | $actual | HTML on oneline |
string | $msg | Optional message |
Definition at line 2101 of file MediaWikiTestCase.php.
References and().
|
protected |
Asserts that the given database query yields the rows given by $expectedRows.
The expected rows should be given as indexed (not associative) arrays, with the values given in the order of the columns in the $fields parameter. Note that the rows are sorted by the columns given in $fields.
string | array | $table | The table(s) to query |
string | array | $fields | The columns to include in the result (and to sort by) |
string | array | $condition | "where" condition(s) |
array | $expectedRows | An array of arrays giving the expected rows. |
array | $options | Options for the query |
array | $join_conds | Join conditions for the query |
MWException | If 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 2000 of file MediaWikiTestCase.php.
References $options, $res, and(), 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\McrWriteBothRevisionStoreDbTest\assertRevisionExistsInDatabase(), MediaWiki\Tests\Revision\PreMcrRevisionStoreDbTest\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().
|
protected |
Asserts the type of the provided value.
This can be either in internal type such as boolean or integer, or a class or interface the value extends or implements.
string | $type | |
mixed | $actual | |
string | $message |
Definition at line 2177 of file MediaWikiTestCase.php.
Referenced by assertTypeOrValue(), MediaWiki\Auth\AbstractAuthenticationProviderTest\testAbstractAuthenticationProvider(), ActionTest\testActionFactory(), MediaWiki\Auth\AuthenticationRequestTest\testBasics(), JobQueueTest\testDeduplicationWhileClaimed(), LanguageTest\testFormatNum(), MediaWiki\Auth\AuthenticationRequestTestCase\testGetFieldInfo(), BagOStuffTest\testGetScopedLock(), MediaWiki\Tests\Storage\NameTableStoreFactoryTest\testIntegratedGetChangeTagDef(), MediaWiki\Tests\Storage\NameTableStoreFactoryTest\testIntegratedGetContentModels(), MediaWiki\Tests\Storage\NameTableStoreFactoryTest\testIntegratedGetSlotRoles(), ShellTest\testMakeScriptCommand(), and ApiStructureTest\validateType().
|
protected |
Asserts that the provided variable is of the specified internal type or equals the $value argument.
This is useful for testing return types of functions that return a certain type or value when not set or on error.
string | $type | |
mixed | $actual | |
mixed | $value | |
string | $message |
Definition at line 2158 of file MediaWikiTestCase.php.
References $type, $value, and(), and assertType().
Referenced by SiteTest\testGetGlobalId(), SiteTest\testGetLanguageCode(), and SiteTest\testGetPath().
|
staticprivate |
Check if we can back up a value by performing a shallow copy.
Values which fail this test are copied recursively.
mixed | $value |
Definition at line 783 of file MediaWikiTestCase.php.
|
protected |
MWException |
Definition at line 1943 of file MediaWikiTestCase.php.
References and().
Referenced by run().
|
protected |
Check if $extName is a loaded PHP extension, will skip the test whenever it is not loaded.
string | $extName |
Definition at line 2288 of file MediaWikiTestCase.php.
References and().
Referenced by CollationTest\setUp(), DiffHistoryBlobTest\setUp(), ExifBitmapTest\setUp(), ExifRotationTest\setUp(), ExifTest\setUp(), FormatMetadataTest\setUp(), JpegTest\setUp(), TiffTest\setUp(), RevisionTest\testCompressRevisionTextUtf8Gzip(), MediaWiki\Tests\Storage\SqlBlobStoreTest\testCompressRevisionTextUtf8Gzip(), HttpTest\testCurlConstants(), RevisionTest\testGetRevisionWithGzipAndLegacyEncoding(), RevisionTest\testGetRevisionWithZlibExtension(), RevisionTest\testGetRevisionWithZlibExtension_badData(), BitmapMetadataHandlerTest\testMultilingualCascade(), PNGMetadataExtractorTest\testPngNativetZtxt(), and BitmapMetadataHandlerTest\testPNGXMP().
|
private |
mixed | $var | |
int | $maxDepth |
Definition at line 873 of file MediaWikiTestCase.php.
References $value, and(), and containsClosure().
Referenced by containsClosure(), and doStashMwGlobals().
Copy test data from one database connection to another.
This should only be used for small data sets.
IDatabase | $source | |
IDatabase | $target |
Definition at line 1914 of file MediaWikiTestCase.php.
References $res, $source, $tables, array(), and Wikimedia\Rdbms\IDatabase\insert().
Referenced by MediaWiki\Tests\Maintenance\BackupDumperPageTest\newStreamingDBConnection(), and MediaWikiTestCaseTest\testCopyTestData().
MediaWikiTestCase::dbPrefix | ( | ) |
Definition at line 1173 of file MediaWikiTestCase.php.
Referenced by listOriginalTables(), LoadBalancerTest\makeServerConfig(), LoadBalancerTest\newMultiServerLocalLoadBalancer(), LoadBalancerTest\newSingleServerLocalLoadBalancer(), setupAllTestDBs(), MediaWikiTestCaseTest\testCopyTestData(), LoadBalancerTest\testTransactionCallbackChains(), and LoadBalancerTest\testWithoutReplica().
|
private |
An internal method that allows setService() to set globals that tests are not supposed to touch.
Definition at line 727 of file MediaWikiTestCase.php.
References $GLOBALS, $value, and(), doStashMwGlobals(), and resetNamespaces().
Referenced by setContentLang(), setMwGlobals(), and setService().
|
private |
Definition at line 821 of file MediaWikiTestCase.php.
References $e, $GLOBALS, and(), containsClosure(), serialize(), and unserialize().
Referenced by doSetMwGlobals(), and stashMwGlobals().
|
private |
Drops the given mock tables.
IMaintainableDatabase | $db | |
array | $tables |
Definition at line 1704 of file MediaWikiTestCase.php.
References $tables, ensureMockDatabaseConnection(), Wikimedia\Rdbms\IDatabase\query(), and Wikimedia\Rdbms\IMaintainableDatabase\tableName().
Referenced by setUpSchema(), and undoSchemaOverrides().
|
protected |
Edits or creates a page/revision.
string | $pageName | Page title |
string | $text | Content of the page |
string | $summary | Optional summary string for the revision |
int | $defaultNs | Optional namespace id |
MWException | If 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 2367 of file MediaWikiTestCase.php.
References needsDB().
Referenced by ApiParseTest\addDBDataOnce(), ApiQueryBasicTest\addDBDataOnce(), ApiQueryContinue2Test\addDBDataOnce(), ApiQueryContinueTest\addDBDataOnce(), ApiMoveTest\createPage(), ApiPageSetTest\createPageSetWithRedirect(), ApiQueryPrefixSearchTest\setUp(), ApiRevisionDeleteTest\setUp(), OutputPageTest\testAddBacklinkSubtitle(), ApiEditPageTest\testAppendNewSection(), ApiEditPageTest\testAppendNewSectionWithInvalidContentModel(), ApiEditPageTest\testAppendNewSectionWithSummary(), ApiEditPageTest\testAppendNewSectionWithTitle(), ApiEditPageTest\testAppendNewSectionWithTitleAndSummary(), ApiEditPageTest\testAppendToFirstSection(), ApiEditPageTest\testAppendToNonexistentSection(), ApiEditPageTest\testAppendToSection(), ApiDeleteTest\testBatchedDelete(), 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\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(), ApiPageSetTest\testSpecialRedirects(), ApiEditPageTest\testUndoAfterToHiddenRev(), ApiEditPageTest\testUndoAfterToInvalidRev(), ApiEditPageTest\testUndoAfterToRevFromDifferentPage(), ApiEditPageTest\testUndoToInvalidRev(), ApiEditPageTest\testUndoToRevFromDifferentPage(), ApiEditPageTest\testUndoWithConflicts(), ApiEditPageTest\testUndoWithSwappedRevisions(), and ApiParseTest\testUnfollowedRedirect().
|
protected |
LogicException | if the given database connection is not a set up to use mock tables. |
Definition at line 1559 of file MediaWikiTestCase.php.
References Wikimedia\Rdbms\IDatabase\tablePrefix().
Referenced by dropMockTables(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\getTestPage(), recloneMockTables(), setUpSchema(), and undoSchemaOverrides().
MediaWikiTestCase::getCliArg | ( | $offset | ) |
string | $offset |
Definition at line 1954 of file MediaWikiTestCase.php.
Referenced by run(), FileBackendTest\setUp(), StoreBatchTest\setUp(), JobQueueTest\setUp(), and BagOStuffTest\setUp().
|
protected |
Returns the ID of a namespace that defaults to Wikitext.
MWException | If there is none. |
Definition at line 2211 of file MediaWikiTestCase.php.
References $namespaces, $wgNamespaceContentModels, and(), CONTENT_MODEL_WIKITEXT, NS_CATEGORY, NS_FILE, NS_HELP, NS_MAIN, and NS_PROJECT.
Referenced by MediaWiki\Tests\Maintenance\BackupDumperPageTest\addDBData(), MediaWiki\Tests\Maintenance\TextPassDumperDatabaseTest\addDBData(), MediaWiki\Tests\Maintenance\FetchTextTest\addDBDataOnce(), EditPageTest\assertEdit(), RefreshLinksJobTest\createPage(), PagePropsTest\createPage(), RevisionDbTestBase\createPage(), MediaWiki\Tests\Storage\PageUpdaterTest\getDummyTitle(), RevisionTest\getMockTitle(), RevisionDbTestBase\getMockTitle(), ArticleViewTest\getPage(), MediaWiki\Tests\Storage\DerivedPageDataUpdaterTest\getTitle(), DifferenceEngineTest\getTitle(), WikiPageDbTestBase\newPage(), EditPageTest\testAutoMerge(), WikiPageNoContentModelDbTest\testGetDeletionUpdates(), WikitextContentTest\testGetSecondaryDataUpdates(), RevisionDbTestBase\testUserWasLastToEdit(), and ArticleViewTest\testViewRedirect().
|
protected |
Returns a WikiPage representing an existing page.
Title | string | null | $title |
MWException | If 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 220 of file MediaWikiTestCase.php.
References $title, and(), EDIT_NEW, EDIT_SUPPRESS_RC, needsDB(), and null.
Referenced by BlockTest\testAppliesToPageOnPartialPageBlock(), BlockTest\testAppliesToReturnsTrueOnSitewideBlock(), BlockTest\testAppliesToTitleOnPartialBlock(), BlockTest\testAppliesToTitleReturnsTrueOnSitewideBlock(), ApiBlockTest\testBlockWithRestrictions(), ActionTest\testCanExecuteRequiresUnblock(), MediaWiki\Tests\Block\BlockRestrictionStoreTest\testDelete(), MediaWiki\Tests\Block\BlockRestrictionStoreTest\testDeleteAllUpdateByParentBlockId(), MediaWiki\Tests\Block\BlockRestrictionStoreTest\testDeleteByBlockId(), MediaWiki\Tests\Block\BlockRestrictionStoreTest\testDeleteByParentBlockId(), PoolWorkArticleViewTest\testDoWorkDeletedContent(), PoolWorkArticleViewTest\testDoWorkLoadRevision(), PoolWorkArticleViewTest\testDoWorkParserCache(), PoolWorkArticleViewTest\testDoWorkWithContent(), PoolWorkArticleViewTest\testDoWorkWithExplicitRevision(), PoolWorkArticleViewTest\testDoWorkWithString(), ApiQueryInfoTest\testExecute(), ApiQueryInfoTest\testExecuteEditActions(), ApiQueryInfoTest\testExecuteEditActionsFull(), ApiQueryInfoTest\testExecuteEditActionsFullBlock(), ApiBaseTest\testGetTitleFromTitleOrPageIdPageId(), ApiBaseTest\testGetTitleOrPageIdPageId(), MediaWiki\Tests\Block\BlockRestrictionStoreTest\testIgnoreNotSupportedTypes(), MediaWiki\Tests\Block\BlockRestrictionStoreTest\testInsert(), BlockTest\testInsertExistingBlock(), MediaWiki\Tests\Block\BlockRestrictionStoreTest\testInsertTypes(), MediaWiki\Tests\Permissions\PermissionManagerTest\testIsBlockedFrom(), UserTest\testIsBlockedFrom(), MediaWiki\Tests\Block\BlockRestrictionStoreTest\testLoadMultipleRestrictions(), PoolWorkArticleViewTest\testMagicWords(), MediaWiki\Tests\Block\BlockRestrictionStoreTest\testMappingPageRestrictionObject(), MediaWiki\Tests\Block\Restriction\NamespaceRestrictionTest\testMatches(), MediaWiki\Tests\Block\Restriction\PageRestrictionTest\testMatches(), SpecialBlockTest\testMaybeAlterFormDefaultsPartial(), MediaWiki\Tests\Block\BlockRestrictionStoreTest\testNoAutoblocksUpdateByParentBlockId(), BlockListPagerTest\testPreprocessResults(), SpecialBlockTest\testProcessFormRestrictions(), SpecialBlockTest\testProcessFormRestrictionsChange(), BlockTest\testRestrictionsFromDatabase(), MediaWiki\Tests\Block\BlockRestrictionStoreTest\testUpdateByParentBlockId(), MediaWiki\Tests\Block\BlockRestrictionStoreTest\testUpdateChange(), MediaWiki\Tests\Block\BlockRestrictionStoreTest\testUpdateInsert(), and MediaWiki\Tests\Block\BlockRestrictionStoreTest\testUpdateSame().
|
staticprotected |
Gets master database connections for all of the ExternalStoreDB stores configured in $wgDefaultExternalStore.
Definition at line 1513 of file MediaWikiTestCase.php.
References $wgDefaultExternalStore, and(), array(), and list.
|
static |
Convenience method for getting a mutable test user.
string | string[] | $groups | Groups the test user should be added in. |
Definition at line 192 of file MediaWikiTestCase.php.
Referenced by LocalIdLookupTest\addDBData(), GenderCacheTest\addDBDataOnce(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\createRevisionStoreCacheRecord(), ApiUserrightsTest\doFailedRightsChange(), ApiUserrightsTest\doSuccessfulRightsChange(), EnhancedChangesListTest\getCategorizationChange(), OldChangesListTest\getContext(), RCCacheEntryFactoryTest\getContext(), EnhancedChangesListTest\getEditChange(), OldChangesListTest\getEditChange(), OldChangesListTest\getLogChange(), EnhancedChangesListTest\getLogChange(), ApiUserrightsTest\getMockForProcessingExpiries(), OldChangesListTest\getNewBotEditChange(), BlockTest\getUserForBlocking(), ApiBlockTest\setUp(), ApiQueryRecentChangesIntegrationTest\setUp(), ApiQueryWatchlistIntegrationTest\setUp(), ApiQueryWatchlistRawIntegrationTest\setUp(), ApiUnblockTest\setUp(), BotPasswordTest\setUp(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testAccountCreation(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testAccountCreationEmail(), UserGroupMembershipTest\testAddAndRemoveGroups(), ApiUserrightsTest\testAddAndRemoveGroups(), ApiBaseTest\testAddBlockInfoToStatus(), ApiMainTest\testAssert(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testAuthentication(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testAuthentication(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testBasics(), ApiBlockTest\testBlockByBlockedUser(), MediaWiki\Tests\Permissions\PermissionManagerTest\testBlockInstanceCache(), UserTest\testBlockInstanceCache(), UserTest\testCheckAndSetTouched(), ApiStashEditTest\testCheckCache(), UserTest\testEquals(), ApiBaseTest\testErrorArrayToStatus(), UserTest\testFindUsersByGroup(), UserTest\testGetEditCount(), UserTest\testIncEditCount(), ActorMigrationTest\testInsertUserIdentity(), UserTest\testLoggedIn(), ParserOptionsTest\testNewCanonical(), RCCacheEntryFactoryTest\testNewForDeleteChange(), RCCacheEntryFactoryTest\testNewForRevUserDeleteChange(), RCCacheEntryFactoryTest\testNewFromRecentChange(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewRevisionFromRow_userNameChange(), UserTest\testOptions(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testProviderChangeAuthenticationData(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testProviderChangeAuthenticationDataEmail(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testSetPasswordResetFlag(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testTestUserCanAuthenticate(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testTestUserCanAuthenticate(), ApiUserrightsTest\testWebToken(), and ApiUserrightsTest\testWithTag().
|
protected |
obtains a new temporary directory
The obtained directory is enlisted to be removed (recursively with all its contained files) upon tearDown.
Definition at line 491 of file MediaWikiTestCase.php.
References and(), getNewTempFile(), and wfMkdirParents().
Referenced by MediaWiki\Tests\Maintenance\TextPassDumperDatabaseTest\checkpointHelper(), FileBackendTest\setUp(), MigrateFileRepoLayoutTest\setUp(), StoreBatchTest\setUp(), MediaWikiMediaTestCase\setUp(), ApiQuerySiteinfoTest\testExtensions(), ApiUploadTest\testUpload(), ApiUploadTest\testUploadChunks(), ApiUploadTest\testUploadSameContent(), ApiUploadTest\testUploadSameFileName(), and ApiUploadTest\testUploadStash().
|
protected |
Obtains a new temporary file name.
The obtained filename is enlisted to be removed upon tearDown
Definition at line 474 of file MediaWikiTestCase.php.
References and(), 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(), 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\BackupDumperLoggerTest\testPlain(), MediaWiki\Tests\Maintenance\TextPassDumperDatabaseTest\testPlain(), MediaWiki\Tests\Maintenance\TextPassDumperDatabaseTest\testPrefetchPlain(), JpegTest\testSwappingICCProfile(), ApiUploadTest\testUploadZeroLength(), GlobalTest\testWfMkdirParents(), MediaWiki\Tests\Maintenance\BackupDumperPageTest\testXmlDumpsBackupUseCase(), and MediaWiki\Tests\Maintenance\BackupDumperLoggerTest\testXmlDumpsBackupUseCaseLogging().
|
protected |
Returns a WikiPage representing a non-existing page.
Title | string | null | $title |
MWException | If 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 256 of file MediaWikiTestCase.php.
References $title, and(), needsDB(), and null.
Referenced by TextContentTest\testDeletionUpdates(), PoolWorkArticleViewTest\testDoWorkMissingPage(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetKnownCurrentRevision_revDelete(), and MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetKnownCurrentRevision_userNameChange().
|
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.
IMaintainableDatabase | $db | The 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. |
Reimplemented in CommentStoreTest, and MediaWikiTestCaseSchema1Test.
Definition at line 1588 of file MediaWikiTestCase.php.
Referenced by setUpSchema().
|
static |
IDatabase | $db |
Definition at line 1182 of file MediaWikiTestCase.php.
References Wikimedia\Rdbms\IDatabase\getType().
|
static |
Convenience method for getting an immutable admin test user.
string[] | $groups | Groups the test user should be added to. |
Definition at line 204 of file MediaWikiTestCase.php.
Referenced by BlockTest\addBlockForUser(), MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProviderTest\getBlockedUser(), ApiUserrightsTest\getMockForProcessingExpiries(), ApiStashEditTest\getStashKey(), MediaWiki\Tests\Block\BlockRestrictionStoreTest\insertBlock(), SpecialBlockTest\insertBlock(), ApiUnblockTest\setUp(), NoWriteWatchedItemStoreUnitTest\testAddWatch(), NoWriteWatchedItemStoreUnitTest\testAddWatchBatchForUser(), BlockTest\testAppliesToNamespaceOnPartialNamespaceBlock(), BlockTest\testAppliesToPageOnPartialPageBlock(), BlockTest\testAppliesToReturnsTrueOnSitewideBlock(), BlockTest\testAppliesToTitleOnPartialBlock(), BlockTest\testAppliesToTitleReturnsTrueOnSitewideBlock(), UserTest\testAutoblockCookieInauthentic(), UserTest\testAutoblockCookieInfiniteExpiry(), UserTest\testAutoblockCookieNoSecretKey(), UserTest\testAutoblockCookies(), UserTest\testAutoblockCookiesDisabled(), ApiUserrightsTest\testBlockedWithoutUserrights(), MediaWiki\Tests\Permissions\PermissionManagerTest\testBlockInstanceCache(), UserTest\testBlockInstanceCache(), ActionTest\testCanExecuteRequiresUnblock(), MediaWiki\Auth\AuthManagerTest\testCheckAccountCreatePermissions(), ApiStashEditTest\testCheckCacheInterveningEdits(), ApiStashEditTest\testCheckCacheOldNoEdits(), NoWriteWatchedItemStoreUnitTest\testCountUnreadNotifications(), NoWriteWatchedItemStoreUnitTest\testCountWatchedItems(), WikiPageDbTestBase\testDoDeleteArticleReal_suppress(), WikiPageDbTestBase\testDoDeleteArticleReal_userSysop(), ApiQueryBlocksTest\testExecuteBlock(), ApiQueryInfoTest\testExecuteEditActionsFullBlock(), ApiQueryBlocksTest\testExecuteRestrictions(), ApiQueryBlocksTest\testExecuteSitewide(), NoWriteWatchedItemStoreUnitTest\testGetNotificationTimestampsBatch(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetRcIdIfUnpatrolled_returnsZeroIfPatrolled(), RevisionDbTestBase\testGetUserAndText(), NoWriteWatchedItemStoreUnitTest\testGetWatchedItem(), NoWriteWatchedItemStoreUnitTest\testGetWatchedItemsForUser(), BlockTest\testInsertExistingBlock(), UserTest\testIpBlockCookieIgnoredWhenUserLoggedIn(), UserTest\testIpBlockCookieNotSet(), UserTest\testIpBlockCookieSet(), MediaWiki\Tests\Permissions\PermissionManagerTest\testIsBlockedFrom(), UserTest\testIsBlockedFrom(), RevisionDbTestBase\testIsMinor_true(), RevisionDbTestBase\testIsUnpatrolled_returnsZeroIfPatrolled(), NoWriteWatchedItemStoreUnitTest\testIsWatched(), NoWriteWatchedItemStoreUnitTest\testLoadWatchedItem(), SpecialBlockTest\testMaybeAlterFormDefaultsPartial(), BlockTest\testNewFromRow(), RCFeedIntegrationTest\testNotify(), BlockListPagerTest\testPreprocessResults(), SpecialBlockTest\testProcessFormExisting(), MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProviderTest\testRangeBlock(), ChangesListSpecialPageTest\testRcHidepatrolledFilter(), ChangesListSpecialPageTest\testRcHideunpatrolledFilter(), ChangesListSpecialPageTest\testRcReviewStatusFilter(), NoWriteWatchedItemStoreUnitTest\testRemoveWatch(), NoWriteWatchedItemStoreUnitTest\testResetNotificationTimestamp(), BlockTest\testRestrictionsFromDatabase(), 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().
|
static |
Convenience method for getting an immutable test user.
string | string[] | $groups | Groups the test user should be in. |
Definition at line 180 of file MediaWikiTestCase.php.
Referenced by BlockTest\addXffBlocks(), RefreshLinksJobTest\createPage(), WikiPageDbTestBase\createPage(), MediaWiki\Tests\Storage\DerivedPageDataUpdaterTest\createRevision(), MediaWiki\Tests\Storage\PageUpdaterTest\createRevision(), PageArchiveMcrTest\getExpectedArchiveRows(), PageArchivePreMcrTest\getExpectedArchiveRows(), ArticleViewTest\getPage(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\getRevisionRecordFromDetailsArray(), MediaWiki\Tests\Block\BlockRestrictionStoreTest\insertBlock(), SpecialBlockTest\insertBlock(), PoolWorkArticleViewTest\makeRevision(), RevisionDbTestBase\makeRevisionWithProps(), OutputPageTest\provideCheckLastModified(), GadgetTest\setUp(), PageArchiveTestBase\setUp(), AbstractChangesListSpecialPageTestCase\setUp(), UserTest\setUp(), MediaWiki\Tests\Maintenance\TextPassDumperDatabaseTest\setUpStub(), BlockTest\testAppliesToNamespaceOnPartialNamespaceBlock(), BlockTest\testAppliesToPageOnPartialPageBlock(), BlockTest\testAppliesToReturnsTrueOnSitewideBlock(), BlockTest\testAppliesToTitleOnPartialBlock(), BlockTest\testAppliesToTitleReturnsTrueOnSitewideBlock(), ApiMainTest\testAssertUser(), UserTest\testAutoblockCookieInauthentic(), UserTest\testAutoblockCookieInfiniteExpiry(), UserTest\testAutoblockCookieNoSecretKey(), UserTest\testAutoblockCookies(), UserTest\testAutoblockCookiesDisabled(), ApiStashEditTest\testBot(), ActionTest\testCanExecute(), ActionTest\testCanExecuteNoRight(), ActionTest\testCanExecuteRequiresUnblock(), ApiStashEditTest\testCheckCache(), FormSpecialPageTestCase\testCheckExecutePermissionsPartialBlock(), FormSpecialPageTestCase\testCheckExecutePermissionsSitewideBlock(), SpecialBlockTest\testCheckUnblockSelf(), UserPasswordPolicyTest\testCheckUserPassword(), MediaWiki\Tests\Storage\PageUpdaterTest\testCompareAndSwapFailure(), RevisionTest\testConstructFromArray_userSetAsExpected(), MediaWiki\Tests\Storage\PageUpdaterTest\testCreatePage(), ApiLoginTest\testDeprecatedUserLogin(), WikiPageDbTestBase\testDoDeleteUpdates(), WikiPageDbTestBase\testDoEditContent(), WikiPageDbTestBase\testDoEditUpdates(), MediaWiki\Tests\Storage\DerivedPageDataUpdaterTest\testDoParserCacheUpdate(), ApiQueryBlocksTest\testExecuteBlock(), ApiQueryInfoTest\testExecuteEditActionsFullBlock(), ApiQueryBlocksTest\testExecuteRestrictions(), ApiQueryBlocksTest\testExecuteSitewide(), UserTest\testExperienceLevel(), MediaWiki\Tests\Storage\PageUpdaterTest\testFailureOnBadContentModel(), MediaWiki\Tests\Storage\PageUpdaterTest\testFailureOnEditFlags(), SpecialWatchlistTest\testFetchOptionsFromRequest(), MediaWiki\Tests\Storage\DerivedPageDataUpdaterTest\testGetCanonicalParserOptions(), UserTest\testGetFirstLatestEditTimestamp(), DefaultPreferencesFactoryTest\testGetForm(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetKnownCurrentRevision(), UserPasswordPolicyTest\testGetPoliciesForUser(), 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(), BlockTest\testInsertExistingBlock(), MediaWiki\Tests\Revision\McrRevisionStoreDbTest\testInsertRevisionOn_T202032(), ActorMigrationTest\testInsertRoundTrip(), ActorMigrationTest\testInsertWithTempTableCallbackMissingFields(), ActorMigrationTest\testInsertWithTempTableDeprecated(), ActorMigrationTest\testInsertWithTempTableWrong(), ActorMigrationTest\testInsertWrong(), UserTest\testIpBlockCookieIgnoredWhenUserLoggedIn(), MediaWiki\Tests\Permissions\PermissionManagerTest\testIsBlockedFrom(), UserTest\testIsBlockedFrom(), SpecialBlockTest\testMaybeAlterFormDefaultsPartial(), UserTest\testNewFromAnyId(), UserTest\testNewFromIdentity(), BlockTest\testNewFromRow(), 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(), SpecialBlockTest\testProcessForm(), SpecialBlockTest\testProcessFormExisting(), SpecialBlockTest\testProcessFormRestrictions(), SpecialBlockTest\testProcessFormRestrictionsChange(), ChangesListSpecialPageTest\testRcHidebyothersFilter(), ChangesListSpecialPageTest\testRcHidebyothersFilter_old(), ChangesListSpecialPageTest\testRcHidemyselfFilter(), ChangesListSpecialPageTest\testRcHidemyselfFilter_old(), ChangesListSpecialPageTest\testRcHidepatrolledDisabledFilter(), ChangesListSpecialPageTest\testRcHideunpatrolledDisabledFilter(), BlockTest\testRestrictionsFromDatabase(), MediaWiki\Tests\Storage\PageUpdaterTest\testSetRcPatrolStatus(), MediaWiki\Tests\Storage\PageUpdaterTest\testSetUseAutomaticEditSummaries(), MediaWiki\Tests\Storage\PageUpdaterTest\testSetUsePageCreationLog(), UserTest\testSoftBlockRanges(), ApiPageSetTest\testSpecialRedirects(), ArticleViewTest\testUnhiddenViewOfDeletedRevision(), ImportTest\testUnknownUserHandling(), MediaWiki\Tests\Storage\PageUpdaterTest\testUpdatePage(), RevisionDbTestBase\testUserCan(), RevisionDbTestBase\testUserCanBitfield(), UserTest\testUserGetRightsHooks(), and ArticleViewTest\testViewMissingUserPage().
MediaWikiTestCase::hideDeprecated | ( | $function | ) |
Don't throw a warning if $function is deprecated and called later.
string | $function |
Definition at line 1974 of file MediaWikiTestCase.php.
References and(), and wfDeprecated().
Referenced by CommentStoreTest\makeStoreWithKey(), UserTest\testActorId(), UserTest\testActorId_old(), OutputPageTest\testAddDeprecatedScriptFileNoOp(), ArticleViewTest\testArticleAfterFetchContentObjectHook(), ArticleViewTest\testArticleContentViewCustomHook(), MWNamespaceTest\testCanTalk(), UserTest\testCheckPasswordValidity(), PasswordPolicyChecksTest\testCheckPopularPasswordBlacklist(), ApiEditPageTest\testEditAbortedByHook(), ApiEditPageTest\testEditAbortedByHookWithCustomOutput(), PageArchiveTestBase\testGetLastRevisionText(), LBFactoryTest\testGetLBFactoryClass(), RevisionDbTestBase\testGetRevisionText(), MediaWikiServicesTest\testGetters(), PageArchivePreMcrTest\testGetTextFromRow(), PageArchiveTestBase\testGetTextFromRowThrowsInvalidArgumentException(), WatchActionTest\testGetUnwatchToken(), ActorMigrationTest\testInsertWithTempTableDeprecated(), CommentStoreTest\testInsertWithTempTableDeprecated(), UserTest\testIsLocallyBlockedProxy(), SearchResultSetTest\testIterate(), DeprecatedGlobalTest\testLazyLoad(), LinkerTest\testLinkBeginHook(), LinkerTest\testLinkEndHook(), RevisionDbTestBase\testLoadFromId(), CommentStoreTest\testNewKey(), LanguageArTest\testNormalize(), LanguageMlTest\testNormalize(), 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(), WfArrayFilterTest\testWfArrayFilter(), and WfArrayFilterTest\testWfArrayFilterByKey().
|
protected |
Insert a new page.
Should be called from addDBData().
string | Title | $pageName | Page name or title |
string | $text | Page's content |
int | null | $namespace | Namespace id (name cannot already contain namespace) |
User | null | $user | If null, static::getTestSysop()->getUser() is used. |
MWException | If 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 1222 of file MediaWikiTestCase.php.
References $title, and(), and needsDB().
Referenced by CategoryMembershipChangeTest\addDBDataOnce(), ContentHandlerTest\addDBDataOnce(), LinksUpdateTest\addDBDataOnce(), CategoryMembershipChangeJobTest\addDBDataOnce(), MergeHistoryTest\addDBDataOnce(), PrefixSearchTest\addDBDataOnce(), SearchEnginePrefixTest\addDBDataOnce(), SearchEngineTest\addDBDataOnce(), SpamBlacklistTest\setUp(), ApiQueryBlocksTest\testExecuteRestrictions(), BlockListPagerTest\testFormatValueRestrictions(), LinkerTest\testGenerateRollback(), MediaWiki\Tests\Storage\PageUpdaterTest\testMagicWords(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewMutableRevisionFromArray(), and MediaWiki\Tests\Storage\PageUpdaterTest\testUpdatePage().
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.
Config | null | $configOverrides | Configuration overrides for the new MediaWikiServices instance. |
Definition at line 978 of file MediaWikiTestCase.php.
|
staticprivate |
Definition at line 1866 of file MediaWikiTestCase.php.
References and().
|
protected |
|
staticprotected |
Check whether ExternalStoreDB is being used.
Definition at line 1537 of file MediaWikiTestCase.php.
References $wgDefaultExternalStore, and(), and array().
|
protected |
Returns true if the given namespace defaults to Wikitext according to $wgNamespaceContentModels.
int | $ns | The namespace ID to check |
Definition at line 2194 of file MediaWikiTestCase.php.
References $wgNamespaceContentModels, and(), and CONTENT_MODEL_WIKITEXT.
Referenced by PrefixSearchTest\addDBDataOnce(), SearchEnginePrefixTest\addDBDataOnce(), SearchEngineTest\addDBDataOnce(), SearchEngineTest\fetchIds(), PrefixSearchTest\setUp(), SearchEnginePrefixTest\setUp(), MediaWiki\Tests\Permissions\PermissionManagerTest\testQuickPermissions(), and TitlePermissionTest\testQuickPermissions().
|
private |
Lists all tables in the live database schema, without a prefix.
IMaintainableDatabase | $db |
Definition at line 1719 of file MediaWikiTestCase.php.
References and(), dbPrefix(), and Wikimedia\Rdbms\IMaintainableDatabase\listTables().
Referenced by recloneMockTables(), setUpSchema(), and undoSchemaOverrides().
|
static |
IMaintainableDatabase | $db |
Definition at line 1877 of file MediaWikiTestCase.php.
References $tables, and(), Wikimedia\Rdbms\IDatabase\getType(), Wikimedia\Rdbms\IMaintainableDatabase\listTables(), Wikimedia\Rdbms\IMaintainableDatabase\listViews(), and Wikimedia\Rdbms\IDatabase\tablePrefix().
|
staticprivate |
Create a config suitable for testing, based on a base config, default overrides, and custom overrides.
Definition at line 288 of file MediaWikiTestCase.php.
References and(), CACHE_ACCEL, CACHE_DB, CACHE_MEMCACHED, CACHE_NONE, and false.
|
staticprivate |
ConfigFactory | $oldFactory | |
Config[] | $configurations |
Definition at line 332 of file MediaWikiTestCase.php.
|
protected |
Skip the test if using the specified database type.
string | $type | Database type |
Definition at line 2303 of file MediaWikiTestCase.php.
Referenced by MediaWikiTestCaseSchema1Test\setUp(), MediaWikiTestCaseSchema2Test\setUp(), MediaWikiTestCaseTest\testCopyTestData(), UserTest\testFindUsersByGroup(), LinkerTest\testGenerateRollback(), MediaWiki\Tests\Storage\NameTableStoreTest\testGetAndAcquireIdInsertCallback(), ApiBaseTest\testGetTitleOrPageIdInvalidPageId(), MediaWiki\Tests\Maintenance\DeleteAutoPatrolLogsTest\testRun(), PrefixSearchTest\testSearch(), PrefixSearchTest\testSearchWithOffset(), MediaWiki\Tests\Storage\SqlBlobStoreTest\testSimpleStoreGetBlobSimpleRoundtripWindowsLegacyEncodingGzip(), ApiQueryUserContribsTest\testSorting(), ChangeTagsTest\testUpdateTags(), ChangeTagsTest\testUpdateTagsDoNothingOnRepeatedCall(), and ChangeTagsTest\testUpdateTagsSkipDuplicates().
|
protected |
Check, if $wgDiff3 is set and ready to merge Will mark the calling test as skipped, if not ready.
Definition at line 2266 of file MediaWikiTestCase.php.
References $wgDiff3, and and().
Referenced by EditPageTest\testAutoMerge(), GlobalTest\testMerge(), WikitextContentHandlerTest\testMerge3(), and GlobalTest\testMerge_worksWithLessParameters().
|
protected |
Merges the given values into a MW global array variable.
Useful for setting some entries in a configuration array, instead of setting the entire array.
string | $name | The name of the global, as in wgFooBar |
array | $values | The array containing the entries to set in that global |
MWException | If the designated global is not an array. |
Definition at line 904 of file MediaWikiTestCase.php.
References $GLOBALS, $name, and(), and setMwGlobals().
Referenced by MediaWiki\Tests\Maintenance\TextPassDumperDatabaseTest\addDBData(), GenderCacheTest\addDBDataOnce(), WikiPageDbTestBase\defineMockContentModelForUpdateTesting(), MediaWiki\Tests\Storage\DerivedPageDataUpdaterTest\defineMockContentModelForUpdateTesting(), DifferenceEngineTest\provideGenerateContentDiffBody(), TextSlotDiffRendererTest\provideGetDiff(), CaptchaPreAuthenticationProviderTest\setMwHook(), ApiUserrightsTest\setPermissions(), setTemporaryHook(), QuestyCaptchaTest\setUp(), ApiEditPageTest\setUp(), ApiOptionsTest\setUp(), ApiRevisionDeleteTest\setUp(), AutoLoaderTest\setUp(), EditPageTest\setUp(), NewUsersLogFormatterTest\setUp(), PageLangLogFormatterTest\setUp(), PagePropsTest\setUp(), RevisionDbTestBase\setUp(), TitleMethodsTest\setUp(), BotPasswordTest\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(), CaptchaPreAuthenticationProviderTest\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(), and UserTest\testUserGetRightsHooks().
|
private |
Definition at line 1692 of file MediaWikiTestCase.php.
References and().
Referenced by setUpSchema().
MediaWikiTestCase::needsDB | ( | ) |
Definition at line 1190 of file MediaWikiTestCase.php.
References isTestInDatabaseGroup().
Referenced by assertSelect(), editPage(), getExistingTestPage(), getNonexistingTestPage(), insertPage(), run(), setUp(), and tearDown().
|
protected |
Does an associative sort that works for objects.
array | &$array |
Definition at line 2115 of file MediaWikiTestCase.php.
References and(), and serialize().
Referenced by assertArrayEquals(), and MediaWiki\Tests\Revision\RevisionQueryInfoTest\assertArrayEqualsIgnoringIntKeyOrder().
|
private |
Definition at line 443 of file MediaWikiTestCase.php.
References and().
Referenced by run().
|
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.
Config | null | $configOverrides | Configuration overrides for the new MediaWikiServices instance. |
callable[] | $services | An associative array of services to re-define. Keys are service names, values are callables. |
MWException |
Definition at line 937 of file MediaWikiTestCase.php.
References $services, and and().
Referenced by ApiQueryUserContribsTest\addDBDataOnce(), resetDB(), run(), PageArchiveTestBase\setUp(), WikiPageDbTestBase\setUp(), MediaWiki\Tests\Permissions\PermissionManagerTest\setUp(), PrefixSearchTest\setUp(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\setUp(), RevisionDbTestBase\setUp(), SearchEnginePrefixTest\setUp(), TitlePermissionTest\setUp(), UserTest\setUp(), InterwikiTest\setWgInterwikiCache(), UserTest\testActorId_old(), SpecialPageFactoryTest\testConflictResolution(), RevisionTest\testConstructFromRowWithBadPageId(), ChangesListSpecialPageTest\testFilterUserExpLevelAllExperienceLevels(), ChangesListSpecialPageTest\testFilterUserExpLevelAllExperienceLevels_old(), ChangesListSpecialPageTest\testFilterUserExpLevelRegistrered(), ChangesListSpecialPageTest\testFilterUserExpLevelRegistrered_old(), ChangesListSpecialPageTest\testFilterUserExpLevelRegistreredOrLearner(), ChangesListSpecialPageTest\testFilterUserExpLevelRegistreredOrLearner_old(), ChangesListSpecialPageTest\testFilterUserExpLevelUnregistrered(), ChangesListSpecialPageTest\testFilterUserExpLevelUnregistrered_old(), ChangesListSpecialPageTest\testFilterUserExpLevelUnregistreredOrExperienced(), ChangesListSpecialPageTest\testFilterUserExpLevelUnregistreredOrExperienced_old(), SpecialPageFactoryTest\testGetAliasListRecursion(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetKnownCurrentRevision_revDelete(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetKnownCurrentRevision_userNameChange(), 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\testRcHidebyothersFilter_old(), ChangesListSpecialPageTest\testRcHidemyselfFilter(), ChangesListSpecialPageTest\testRcHidemyselfFilter_old(), GlobalTest\testReadOnlyGlobalChange(), GlobalTest\testReadOnlySet(), 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(), ApiQueryUserContribsTest\testSorting(), MediaWiki\Tests\Permissions\PermissionManagerTest\testUserBlock(), and TitlePermissionTest\testUserBlock().
|
static |
Definition at line 276 of file MediaWikiTestCase.php.
|
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.
IMaintainableDatabase | $db | |
array | $tables |
Definition at line 1754 of file MediaWikiTestCase.php.
References $tables, and(), ensureMockDatabaseConnection(), listOriginalTables(), and Wikimedia\Rdbms\IDatabase\tablePrefix().
Referenced by undoSchemaOverrides().
|
private |
Empty all tables so they can be repopulated for tests.
Database | $db,|null | Database to reset |
array | $tablesUsed | Tables to reset |
Definition at line 1776 of file MediaWikiTestCase.php.
References addCoreDBData(), and(), Wikimedia\Rdbms\IDatabase\getType(), overrideMwServices(), and truncateTable().
Referenced by run(), and undoSchemaOverrides().
|
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 755 of file MediaWikiTestCase.php.
Referenced by doSetMwGlobals(), and tearDown().
|
static |
Resets some non-service singleton instances and other static caches.
It's not necessary to reset services here.
Definition at line 361 of file MediaWikiTestCase.php.
References $type, $wgJobClasses, $wgRequest, and(), FileBackendGroup\destroySingleton(), and User\resetGetDefaultOptionsForTestsOnly().
|
private |
Restores loggers replaced by setLogger().
Definition at line 1146 of file MediaWikiTestCase.php.
References and().
Referenced by tearDown().
|
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.
Definition at line 1036 of file MediaWikiTestCase.php.
|
protected |
Revision-deletes a revision.
Revision | int | $rev | Revision to delete |
array | $value | Keys 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 | $comment | Deletion comment |
Definition at line 2387 of file MediaWikiTestCase.php.
References $rev, $value, and(), RevisionDeleter\createList(), and Revision\newFromId().
Referenced by ApiParseTest\addDBDataOnce(), ApiStashEditTest\testDeletedRevision(), and ApiStashEditTest\testDeletedRevisionSection().
MediaWikiTestCase::run | ( | PHPUnit_Framework_TestResult | $result = null | ) |
Definition at line 385 of file MediaWikiTestCase.php.
References addCoreDBData(), addDBData(), addDBDataOnce(), and(), checkDbIsSupported(), DB_MASTER, getCliArg(), isTestInDatabaseGroup(), needsDB(), oncePerClass(), overrideMwServices(), resetDB(), setupAllTestDBs(), and setUpSchema().
MediaWikiTestCase::setCliArg | ( | $offset, | |
$value ) |
string | $offset | |
mixed | $value |
Definition at line 1963 of file MediaWikiTestCase.php.
References $value.
MediaWikiTestCase::setContentLang | ( | $lang | ) |
string | Language | $lang |
Definition at line 1066 of file MediaWikiTestCase.php.
References $lang, $services, doSetMwGlobals(), setMwGlobals(), and setService().
Referenced by MediaWiki\Tests\Maintenance\BackupDumperPageTest\addDBData(), MessageCacheTest\configureLanguages(), ApiOptionsTest\setUp(), CategoryTest\setUp(), CategoryMembershipChangeTest\setUp(), EditPageTest\setUp(), ExtraParserTest\setUp(), HtmlTest\setUp(), CategoryMembershipChangeJobTest\setUp(), MagicVariableTest\setUp(), StripStateTest\setUp(), SampleTest\setUp(), SpecialPageTest\setUp(), MediaWikiTitleCodecTest\setUp(), NaiveImportTitleFactoryTest\setUp(), NamespaceImportTitleFactoryTest\setUp(), SubpageImportTitleFactoryTest\setUp(), TitleTest\setUp(), LanguageConverterTest\setUp(), MediaWikiLangTestCase\setUp(), 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().
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 );
array | string | $newPerms | Either 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 1095 of file MediaWikiTestCase.php.
References $value, $wgGroupPermissions, and(), and setMwGlobals().
Referenced by ApiUserrightsTest\setPermissions(), LocalIdLookupTest\setUp(), MediaWiki\Auth\AuthManagerTest\testAutoAccountCreation(), ApiLoginTest\testBotPasswordThrottled(), MediaWiki\Auth\AuthManagerTest\testCheckAccountCreatePermissions(), ApiMainTest\testCheckExecutePermissionsReadProhibited(), ApiMainTest\testCheckExecutePermissionWriteApiProhibited(), SpecialBlockTest\testCheckUnblockSelf(), ApiMainTest\testSetCacheModePrivateWiki(), ApiParseTest\testSuppressed(), ApiMoveTest\testSuppressRedirectNoPermission(), ApiMoveTest\testTagsNoPermission(), ApiQueryTitleBlacklistTest\testTboverride(), ApiUnblockTest\testUnblockNoPermission(), ApiUnblockTest\testUnblockWithProhibitedTag(), ApiQuerySiteinfoTest\testUserGroups(), and ApiUserrightsTest\testWithoutTagPermission().
|
protected |
Set an ini setting for the duration of the test.
string | $name | Name of the setting |
string | $value | Value to set |
Definition at line 745 of file MediaWikiTestCase.php.
References $name, $value, and and().
Referenced by LanguageConverterTest\testAutoConvertT124404().
|
protected |
Sets the logger for a specified channel, for the duration of the test.
string | $channel | |
LoggerInterface | $logger |
Definition at line 1118 of file MediaWikiTestCase.php.
References and().
Referenced by GlobalTest\testDebugFunctionTest(), ResourceLoaderStartUpModuleTest\testGetModuleRegistrations(), MediaWikiTestCaseTest\testLoggersAreRestoredOnTearDown_replacingExistingLogger(), MediaWikiTestCaseTest\testLoggersAreRestoredOnTearDown_replacingNonExistingLogger(), MediaWikiTestCaseTest\testLoggersAreRestoredOnTearDown_replacingSameLoggerTwice(), ResourceLoaderTest\testMakeModuleResponseError(), ResourceLoaderTest\testMakeModuleResponseErrorCSS(), ResourceLoaderTest\testMakeModuleResponseStartupError(), ApiMainTest\testNonWhitelistedCorsWithCookies(), MediaWikiTest\testPostSendJobDoesNotSetCookie(), and ResourceLoaderTest\testRespondInternalFailures().
|
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().
array | string | $pairs | Key to the global variable, or an array of key/value pairs. |
mixed | null | $value | Value to set the global to (ignored if an array is given as first argument). |
Definition at line 709 of file MediaWikiTestCase.php.
References $value, and(), and doSetMwGlobals().
Referenced by SearchEngineTest\addDBDataOnce(), EditPageTest\assertEdit(), ApiFormatBaseTest\encodeData(), mergeMwGlobalArrayValue(), ApiQuerySearchTest\registerMockSearchEngine(), PrefixSearchTest\searchProvision(), SearchEnginePrefixTest\searchProvision(), TitleTest\secureAndSplitGlobals(), ObjectCacheTest\setCacheConfig(), CaptchaTest\setCaptchaTriggersAttribute(), setContentLang(), setGroupPermissions(), CaptchaPreAuthenticationProviderTest\setTriggers(), CaptchaAuthenticationRequestTest\setUp(), CaptchaPreAuthenticationProviderTest\setUp(), SpamBlacklistTest\setUp(), ApiQueryTitleBlacklistTest\setUp(), ActionTest\setUp(), ApiBlockTest\setUp(), ApiComparePagesTest\setUp(), ApiEditPageTest\setUp(), ApiQueryPrefixSearchTest\setUp(), ApiStashEditTest\setUp(), ApiTestCase\setUp(), ApiUploadTestCase\setUp(), ApiFormatBaseTest\setUp(), ApiQueryTest\setUp(), MediaWiki\Auth\UserDataAuthenticationRequestTest\setUp(), LocalisationCacheTest\setUp(), CategoryTest\setUp(), OldChangesListTest\setUp(), RCCacheEntryFactoryTest\setUp(), ContentHandlerTest\setUp(), CssContentTest\setUp(), TextContentTest\setUp(), ContentSecurityPolicyTest\setUp(), DeprecationHelperTest\setUp(), LinksUpdateTest\setUp(), SearchUpdateTest\setUp(), EditPageTest\setUp(), ExportTest\setUp(), ExtraParserTest\setUp(), LocalFileTest\setUp(), GitInfoTest\setUp(), GlobalTest\setUp(), WfParseUrlTest\setUp(), WfThumbIsStandardTest\setUp(), HtmlTest\setUp(), CategoryMembershipChangeJobTest\setUp(), CSSMinTest\setUp(), PageDataRequestHandlerTest\setUp(), LinkRendererTest\setUp(), LinkFilterTest\setUp(), LogFormatterTest\setUp(), PageLangLogFormatterTest\setUp(), BitmapMetadataHandlerTest\setUp(), BitmapScalingTest\setUp(), ExifBitmapTest\setUp(), ExifRotationTest\setUp(), ExifTest\setUp(), FormatMetadataTest\setUp(), JpegTest\setUp(), TiffTest\setUp(), MediaWikiTest\setUp(), MessageTest\setUp(), MWNamespaceTest\setUp(), MWTimestampTest\setUp(), ObjectCacheTest\setUp(), ImagePage404Test\setUp(), ImagePageTest\setUp(), PageArchiveTestBase\setUp(), WikiPageDbTestBase\setUp(), PagePropsTest\setUp(), ParserOptionsTest\setUp(), MediaWiki\Tests\Permissions\PermissionManagerTest\setUp(), DefaultPreferencesFactoryTest\setUp(), PrefixSearchTest\setUp(), RCFeedIntegrationTest\setUp(), ResourceLoaderTest\setUp(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\setUp(), RevisionDbTestBase\setUp(), RevisionTest\setUp(), SampleTest\setUp(), SearchEnginePrefixTest\setUp(), SearchEngineTest\setUp(), MediaWiki\Session\BotPasswordSessionProviderTest\setUp(), AbstractChangesListSpecialPageTestCase\setUp(), SpecialPageTest\setUp(), SpecialWatchlistTest\setUp(), TemplateParserTest\setUp(), MediaWikiTitleCodecTest\setUp(), NaiveImportTitleFactoryTest\setUp(), SubpageImportTitleFactoryTest\setUp(), TitlePermissionTest\setUp(), TitleTest\setUp(), UploadBaseTest\setUp(), UploadFromUrlTest\setUp(), BotPasswordTest\setUp(), UserGroupMembershipTest\setUp(), UserTest\setUp(), MWCryptHKDFTest\setUp(), MWGrantsTest\setUp(), WikiMapTest\setUp(), XmlTest\setUp(), LanguageConverterTest\setUp(), CategoryChangesAsRdfTest\setUp(), MediaWiki\Tests\Maintenance\DumpTestCase\setUp(), ResourceLoaderTestCase\setUp(), OutputPageTest\setupFeedLinks(), ApiLoginTest\setUpForBotPassword(), RepoGroupTest\setUpForeignRepo(), ApiParseTest\setupInterwiki(), setUserLang(), InterwikiTest\setWgInterwikiCache(), UserTest\testActorId_old(), DeferredUpdatesTest\testAddCallableUpdate(), DeferredUpdatesTest\testAddMergeable(), ApiFormatBaseTest\testApiFrameOptions(), BlockTest\testAppliesToNamespaceOnPartialNamespaceBlock(), BlockTest\testAppliesToPageOnPartialPageBlock(), BlockTest\testAppliesToReturnsTrueOnSitewideBlock(), BlockTest\testAppliesToTitleOnPartialBlock(), BlockTest\testAppliesToTitleReturnsTrueOnSitewideBlock(), FileBackendTest\testAsyncWrites(), MediaWiki\Auth\AuthManagerTest\testAutoAccountCreation(), UserTest\testAutoblockCookieInauthentic(), UserTest\testAutoblockCookieInfiniteExpiry(), UserTest\testAutoblockCookieNoSecretKey(), UserTest\testAutoblockCookies(), UserTest\testAutoblockCookiesDisabled(), BotPasswordTest\testBasics(), ApiDeleteTest\testBatchedDelete(), BlockTest\testBlockAllowsPurge(), ApiBlockTest\testBlockWithoutRestrictions(), ApiBlockTest\testBlockWithProhibitedEmailBlock(), ApiBlockTest\testBlockWithProhibitedTag(), ApiBlockTest\testBlockWithRestrictions(), ApiLoginTest\testBotPasswordThrottled(), FileTest\testCanAnimateThumbIfAppropriate(), CaptchaTest\testCanSkipCaptchaIPWhitelisted(), CaptchaTest\testCaptchaTriggersAttributeGetsOverwritten(), 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(), SpecialBlockTest\testCheckUnblockSelf(), ExtraParserTest\testCleanSigDisabled(), SpecialPageFactoryTest\testConflictResolution(), RevisionTest\testConstructFromArray_userSetAsExpected(), GlobalVarConfigTest\testConstructor(), MediaWiki\Auth\ThrottlerTest\testConstructor(), ResourceLoaderTest\testConstructRegistrationHook(), ApiQuerySiteinfoTest\testContinuation(), MediaWiki\Session\CookieSessionProviderTest\testCookieData(), ApiEditPageTest\testCreateImageRedirectLoggedIn(), EditPageTest\testCreatePage(), EditPageTest\testCreatePageTrx(), ContentSecurityPolicyTest\testCSPIsEnabled(), ApiQuerySiteinfoTest\testDbReplLagInfo(), GlobalTest\testDebugFunctionTest(), ApiDeleteTest\testDeleteWithoutTagPermission(), ApiLoginTest\testDeprecatedUserLogin(), WebRequestTest\testDetectServer(), ApiFormatBaseTest\testDisable(), ApiParseTest\testDisableTidy(), ApiStructureTest\testDocumentationExists(), WikiPageDbTestBase\testDoEditContent(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testDomainCheck(), SiteStatsUpdateTest\testDoUpdate(), DeferredUpdatesTest\testDoUpdatesCLI(), DeferredUpdatesTest\testDoUpdatesWeb(), AutopromoteTest\testEditCountLookupIsSkippedIfRequirementIsZero(), ApiEditPageTest\testEditWithoutTagPermission(), BadTitleErrorTest\testExceptionSetsStatusCode(), ThrottledErrorTest\testExceptionSetsStatusCode(), UserTest\testExperienceLevel(), ExtensionRegistryTest\testExportExtractedDataGlobals(), ApiLoginTest\testExtendedDescription(), ApiQuerySiteinfoTest\testExtensions(), SideBarTest\testExternalUrlsRequireADescription(), CentralIdLookupTest\testFactory(), ApiQuerySiteinfoTest\testFileExtensions(), ChangesListSpecialPageTest\testFilterUserExpLevel(), ChangesListSpecialPageTest\testFilterUserExpLevelAllExperienceLevels(), ChangesListSpecialPageTest\testFilterUserExpLevelAllExperienceLevels_old(), ChangesListSpecialPageTest\testFilterUserExpLevelRegistrered(), ChangesListSpecialPageTest\testFilterUserExpLevelRegistrered_old(), ChangesListSpecialPageTest\testFilterUserExpLevelRegistreredOrLearner(), ChangesListSpecialPageTest\testFilterUserExpLevelRegistreredOrLearner_old(), ChangesListSpecialPageTest\testFilterUserExpLevelUnregistrered(), ChangesListSpecialPageTest\testFilterUserExpLevelUnregistrered_old(), ChangesListSpecialPageTest\testFilterUserExpLevelUnregistreredOrExperienced(), ChangesListSpecialPageTest\testFilterUserExpLevelUnregistreredOrExperienced_old(), RepoGroupTest\testForEachForeignRepoNone(), LinkerTest\testFormatComment(), LinkerTest\testFormatLinksInComment(), LanguageTest\testFormatNum(), BlockListPagerTest\testFormatValue(), BlockListPagerTest\testFormatValueRestrictions(), ApiQuerySiteinfoTest\testGeneral(), FileTest\testGenerateBucketsIfNeeded(), DifferenceEngineTest\testGenerateContentDiffBody(), DifferenceEngineTest\testGenerateTextDiffBody(), QuestyCaptchaTest\testGetCaptcha(), WikitextContentHandlerTest\testGetChangeTag(), ContentHandlerTest\testGetChangeTag(), ContentHandlerTest\testGetContentText_NonTextContent_fail(), ContentHandlerTest\testGetContentText_NonTextContent_ignore(), ContentHandlerTest\testGetContentText_NonTextContent_serialize(), ContentHandlerTest\testGetContentText_Null(), ContentHandlerTest\testGetContentText_TextContent(), DifferenceEngineTest\testGetDiffBody(), SpecialBlockTest\testGetFormFields(), SpecialBlockTest\testGetFormFieldsPartialBlocks(), TitleTest\testGetFragmentForURL(), SvgHandlerTest\testGetIndependentMetaArray(), WebRequestTest\testGetIP(), WebRequestTest\testGetIpLackOfRemoteAddrThrowAnException(), ImagePageTest\testGetLanguageForRendering(), TitleMethodsTest\testGetLinkURL(), ResourceLoaderSkinModuleTest\testGetLogoData(), TitleTest\testGetPageViewLanguage(), DeferredUpdatesTest\testGetPendingUpdates(), HttpTest\testGetProxy(), SpecialShortpagesTest\testGetQueryInfoRespectsContentNS(), WikiPageDbTestBase\testGetRedirectTarget(), CssContentTest\testGetRedirectTarget(), JavaScriptContentTest\testGetRedirectTarget(), MediaWiki\Session\ImmutableSessionProviderWithCookieTest\testGetSessionIdFromCookie(), ChangeTagsTest\testGetSoftwareTags(), ParserOutputTest\testGetText(), MediaWiki\Tests\EditPage\TextboxBuilderTest\testGetTextboxProtectionCSSClasses(), FileTest\testGetThumbnailBucket(), ResourceLoaderStartUpModuleTest\testGetVersionHash_varyConfig(), WikiMapTest\testGetWiki(), ApiLoginTest\testGoodPass(), ParserMethodsTest\testGuessSectionNameFromWikiText(), GlobalVarConfigTest\testHas(), RepoGroupTest\testHasForeignRepoNegative(), RequestContextTest\testImportScopedSession(), MessageTest\testInContentLanguageOverride(), RevisionDbTestBase\testInsertOn_exceptionOnIncomplete(), RevisionDbTestBase\testInsertOn_success(), ActorMigrationTest\testInsertUserIdentity(), ImportLogFormatterTest\testInterwikiLogDatabaseRows(), ApiQuerySiteinfoTest\testInterwikiMap(), ApiQueryUserContribsTest\testInterwikiUser(), UserTest\testIpBlockCookieIgnoredWhenUserLoggedIn(), UserTest\testIpBlockCookieNotSet(), UserTest\testIpBlockCookieSet(), LocalIdLookupTest\testIsAttachedShared(), MediaWiki\Tests\Permissions\PermissionManagerTest\testIsBlockedFrom(), UserTest\testIsBlockedFrom(), MWExceptionTest\testisCommandLine(), TextContentTest\testIsCountable(), WikiPageDbTestBase\testIsCountable(), WikiMapTest\testIsCurrentWikiDomain(), WikiMapTest\testIsCurrentWikiId(), SvgHandlerTest\testIsEnabled(), 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(), MediaWiki\Auth\UserDataAuthenticationRequestTest\testLoadFromSubmission(), RevisionTest\testLoadFromTitle(), MediaWiki\Tests\Block\BlockRestrictionStoreTest\testLoadMultipleRestrictions(), BotPasswordTest\testLogin(), LinkFilterTest\testMakeIndexes(), ResourceLoaderTest\testMakeLoaderImplementScript(), CssContentHandlerTest\testMakeRedirectContent(), JavaScriptContentHandlerTest\testMakeRedirectContent(), ShellTest\testMakeScriptCommand(), UploadBaseTest\testMaxUploadSize(), SpecialBlockTest\testMaybeAlterFormDefaults(), SpecialBlockTest\testMaybeAlterFormDefaultsPartial(), MessageTest\testMessageAsParam(), ExifRotationTest\testMetadataAutoRotate(), ExifRotationTest\testMetadataAutoRotateUnsupported(), ExifRotationTest\testMetadataNoAutoRotate(), ChangeTagsTest\testModifyDisplayQuery(), BitmapMetadataHandlerTest\testMultilingualCascade(), ApiQuerySiteinfoTest\testNamespaces(), CaptchaTest\testNamespaceTriggersOverwrite(), 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(), SvgHandlerTest\testNormaliseParamsInternal(), LanguageArTest\testNormalize(), LanguageMlTest\testNormalize(), MediaWikiSiteTest\testNormalizePageTitle(), RCFeedIntegrationTest\testNotify(), ApiFormatBaseTest\testNullMimeType(), LinksUpdateTest\testOnAddingAndRemovingCategory_recentChangesRowIsAdded(), LinksUpdateTest\testOnAddingAndRemovingCategoryToTemplates_embeddingPagesAreIgnored(), ParserOptionsTest\testOptionsHash(), MediaWiki\Session\ImmutableSessionProviderWithCookieTest\testPersistSession(), ApiMoveTest\testPingLimiter(), JpegPixelFormatTest\testPixelFormatRendering(), ResourceLoaderModuleTest\testPlaceholderize(), MediaWikiTest\testPostSendJobDoesNotSetCookie(), ResourceLoaderSkinModuleTest\testPreloadLinkHeaders(), DeferredUpdatesTest\testPresendAddOnPostsendRun(), SpecialBlockTest\testProcessForm(), SpecialBlockTest\testProcessFormExisting(), SpecialBlockTest\testProcessFormRestrictions(), SpecialBlockTest\testProcessFormRestrictionsChange(), ApiEditPageTest\testProhibitedAnonymousEdit(), ApiEditPageTest\testProhibitedChangeContentModel(), CdnCacheUpdateTest\testPurgeMergeWeb(), ContribsPagerTest\testQueryableRanges(), MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProviderTest\testRangeBlock(), MessageTest\testRawHtmlInMsg(), ChangesListSpecialPageTest\testRcHidebyothersFilter(), ChangesListSpecialPageTest\testRcHidebyothersFilter_old(), ChangesListSpecialPageTest\testRcHidemyselfFilter(), ChangesListSpecialPageTest\testRcHidemyselfFilter_old(), 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(), DeferredUpdatesTest\testRunOuterScopeUpdate(), 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(), SideBarTest\testTestAttributesAssertionHelper(), CaptchaPreAuthenticationProviderTest\testTestForAuthentication(), ApiQueryTest\testTitlePartToKey(), ApiQueryTest\testTitlesGetNormalized(), ApiEditPageTest\testTooBigEdit(), MailAddressTest\testToString(), CaptchaTest\testTriggersCaptcha(), ImportTest\testUnknownUserHandling(), ContribsPagerTest\testUnqueryableRanges(), ApiLoginTest\testUnsupportedAuthResponseType(), LinksUpdateTest\testUpdate_categorylinks(), LinksUpdateTest\testUpdate_langlinks(), LinksUpdateTest\testUpdate_page_props_without_sortkey(), EditPageTest\testUpdatePage(), EditPageTest\testUpdatePageTrx(), JavaScriptContentTest\testUpdateRedirect(), ApiUploadTest\testUploadChunks(), ApiUploadTest\testUploadStash(), MWExceptionTest\testUseMessageCache(), MWExceptionTest\testUseOutputPage(), TimeAdjustTest\testUserAdjust(), MediaWiki\Tests\Permissions\PermissionManagerTest\testUserBlock(), TitlePermissionTest\testUserBlock(), MediaWiki\Tests\Permissions\PermissionManagerTest\testUserBlockAction(), TitlePermissionTest\testUserBlockAction(), RevisionDbTestBase\testUserCan(), RevisionDbTestBase\testUserCanBitfield(), ApiQuerySiteinfoTest\testUserGroups(), LinkerTest\testUserLink(), ResourceLoaderModuleTest\testValidateScriptFile(), WfExpandUrlTest\testWfExpandUrl(), TitleTest\testWgWhitelistReadRegexp(), AutoLoaderTest\testWrongCaseClass(), AutoLoaderTest\testWrongCaseSerializedClass(), and GlobalTest\wfWikiID().
|
protected |
Sets a service, maintaining a stashed version of the previous service to be restored in tearDown.
string | $name | |
object | $object |
Definition at line 649 of file MediaWikiTestCase.php.
References $name, and doSetMwGlobals().
Referenced by ApiMainTest\doTestCheckMaxLag(), ApiOpenSearchTest\replaceSearchEngine(), ApiOpenSearchTest\replaceSearchEngineConfig(), TitleTest\secureAndSplitGlobals(), setContentLang(), CaptchaPreAuthenticationProviderTest\setUp(), ApiParseTest\setupSkin(), RevisionTest\testCompressRevisionTextUtf8Gzip(), ApiQuerySiteinfoTest\testDbReplLagInfo(), RevisionTest\testDecompressRevisionText(), ExternalStoreTest\testExternalFetchFromURL_noExternalStores(), ExternalStoreTest\testExternalFetchFromURL_someExternalStore(), WebRequestTest\testGetIP(), WebRequestTest\testGetIpLackOfRemoteAddrThrowAnException(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetKnownCurrentRevision_revDelete(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetKnownCurrentRevision_userNameChange(), TitleMethodsTest\testGetLinkURL(), 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().
|
protected |
Create a temporary hook handler which will be reset by tearDown.
This replaces other handlers for the same hook.
string | $hookName | Hook name |
mixed | $handler | Value suitable for a hook handler |
Definition at line 2325 of file MediaWikiTestCase.php.
References $handler, and mergeMwGlobalArrayValue().
Referenced by MediaWiki\Auth\AuthManagerTest\hook(), ParserOptionsTest\setUp(), SpecialWatchlistTest\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(), ContentHandlerTest\testGetContentModelsHook(), DefaultPreferencesFactoryTest\testGetForm(), ApiQuerySiteinfoTest\testGetHooks(), SpecialShortpagesTest\testGetQueryInfoRespectsContentNS(), ContentHandlerTest\testGetSlotDiffRenderer_hook(), ShellTest\testMakeScriptCommand(), ApiParseTest\testModules(), MovePageTest\testMoveAbortedByTitleMoveHook(), ApiLoginTest\testNoSameOriginSecurity(), ParserOptionsTest\testOptionsHash(), SearchEngineTest\testParseNamespacePrefix(), MediaWikiTest\testPostSendJobDoesNotSetCookie(), DefaultPreferencesFactoryTest\testPreferencesFormPreSaveHookHasCorrectData(), SearchEngineTest\testSearchIndexFields(), ArticleViewTest\testShowMissingArticleHook(), ApiQuerySiteinfoTest\testStatistics(), ParserOptionsTest\testUsedLazyOptionsInHash(), AbstractChangesListSpecialPageTestCase\testValidateOptions(), and ArticleViewTest\testViewNonText().
|
protected |
Reimplemented in CaptchaAuthenticationRequestTest, CaptchaPreAuthenticationProviderTest, QuestyCaptchaTest, GadgetTest, SpamBlacklistTest, ApiQueryTitleBlacklistTest, ActionTest, WatchActionTest, ApiBlockTest, ApiComparePagesTest, ApiDeleteTest, ApiEditPageTest, ApiLoginTest, ApiLogoutTest, ApiOptionsTest, ApiQueryPrefixSearchTest, ApiQueryRecentChangesIntegrationTest, ApiQuerySearchTest, ApiQueryWatchlistIntegrationTest, ApiQueryWatchlistRawIntegrationTest, ApiRevisionDeleteTest, ApiSetNotificationTimestampIntegrationTest, ApiStashEditTest, ApiTestCase, ApiUnblockTest, ApiUploadTestCase, ApiUserrightsTest, ApiFormatBaseTest, ApiQueryTest, MediaWiki\Auth\UserDataAuthenticationRequestTest, AutoLoaderTest, MediaWiki\Tests\Block\BlockRestrictionStoreTest, LocalisationCacheTest, MessageCacheTest, CategoryTest, CategoryMembershipChangeTest, ChangesListFilterTest, OldChangesListTest, RCCacheEntryFactoryTest, RecentChangeTest, ChangeTagsTest, CollationTest, CustomUppercaseCollationTest, ContentHandlerTest, CssContentTest, FileContentHandlerTest, TextContentTest, WikitextContentHandlerTest, ContentSecurityPolicyTest, DatabaseSqliteTest, DeprecationHelperTest, MediaWiki\Logger\Monolog\AvroFormatterTest, MediaWiki\Logger\Monolog\KafkaHandlerTest, MediaWiki\Logger\Monolog\LineFormatterTest, MWDebugTest, LinksUpdateTest, SearchUpdateTest, DeprecatedGlobalTest, DifferenceEngineTest, DiffHistoryBlobTest, EditPageTest, ExportTest, ExtraParserTest, FauxResponseTest, FileBackendTest, SwiftFileBackendTest, LocalFileTest, MigrateFileRepoLayoutTest, StoreBatchTest, FormOptionsInitializationTest, FormOptionsTest, GitInfoTest, GlobalTest, WfParseUrlTest, WfThumbIsStandardTest, HooksTest, HtmlTest, ImportLinkCacheIntegrationTest, InterwikiLookupAdapterTest, JobQueueTest, CategoryMembershipChangeJobTest, ClearUserWatchlistJobTest, RefreshLinksJobTest, CSSMinTest, BagOStuffTest, MultiWriteBagOStuffTest, ReplicatedBagOStuffTest, PageDataRequestHandlerTest, LinkRendererFactoryTest, LinkRendererTest, LinkFilterTest, DatabaseLogEntryTest, LogFormatterTest, NewUsersLogFormatterTest, PageLangLogFormatterTest, BitmapMetadataHandlerTest, BitmapScalingTest, DjVuTest, ExifBitmapTest, ExifRotationTest, ExifTest, FormatMetadataTest, GIFHandlerTest, GIFMetadataExtractorTest, JpegMetadataExtractorTest, JpegPixelFormatTest, JpegTest, MediaWikiMediaTestCase, PNGHandlerTest, PNGMetadataExtractorTest, TiffTest, WebPHandlerTest, XCFHandlerTest, MediaWikiTest, MessageTest, MultiHttpClientTest, MWNamespaceTest, MWTimestampTest, MemcachedBagOStuffTest, ObjectCacheTest, RESTBagOStuffTest, OutputPageTest, ArticleTest, ArticleViewTest, ImagePage404Test, ImagePageTest, PageArchiveTestBase, WikiPageDbTestBase, WikiPageMcrDbTest, PagePropsTest, MagicVariableTest, ParserOptionsTest, ParserPreloadTest, PreprocessorTest, StripStateTest, TidyTest, Argon2PasswordTest, PasswordTestCase, Pbkdf2PasswordTest, PathRouterTest, MediaWiki\Tests\Permissions\PermissionManagerTest, DefaultPreferencesFactoryTest, PrefixSearchTest, RCFeedIntegrationTest, ExtensionProcessorTest, ExtensionRegistryTest, ResourceLoaderFileModuleTest, ResourceLoaderImageTest, ResourceLoaderTest, MediaWiki\Tests\Revision\MutableRevisionRecordTest, MediaWiki\Tests\Revision\RenderedRevisionTest, MediaWiki\Tests\Revision\RevisionStoreDbTestBase, RevisionDbTestBase, RevisionMcrDbTest, RevisionTest, SampleTest, SearchEnginePrefixTest, SearchEngineTest, MediaWiki\Session\BotPasswordSessionProviderTest, SiteConfigurationTest, AbstractChangesListSpecialPageTestCase, SpecialPageTest, ContribsPagerTest, SpecialMIMESearchTest, SpecialPageTestBase, SpecialWatchlistTest, MediaWiki\Tests\Storage\NameTableStoreTest, MediaWiki\Tests\Storage\PageUpdaterTest, TemplateParserTest, TimeAdjustTest, MediaWikiTitleCodecTest, NaiveImportTitleFactoryTest, NamespaceImportTitleFactoryTest, SubpageImportTitleFactoryTest, TitleMethodsTest, TitlePermissionTest, TitleTest, UploadBaseTest, UploadFromUrlTest, UploadStashTest, BotPasswordTest, LocalIdLookupTest, UserGroupMembershipTest, UserTest, MWCryptHKDFTest, MWGrantsTest, WatchedItemStoreIntegrationTest, WebRequestTest, WikiMapTest, XmlSelectTest, XmlTest, LanguageClassesTestCase, LanguageConverterTest, MediaWiki\Tests\Maintenance\BackupDumperPageTest, MediaWiki\Tests\Maintenance\TextPassDumperDatabaseTest, CategoryChangesAsRdfTest, MediaWiki\Tests\Maintenance\DeleteAutoPatrolLogsTest, MediaWiki\Tests\Maintenance\DumpTestCase, MediaWiki\Tests\Maintenance\FetchTextTest, MediaWiki\Tests\Maintenance\MaintenanceBaseTestCase, MediaWikiLangTestCase, ResourceLoaderTestCase, SideBarTest, DatabaseIntegrationTest, MediaWikiTestCaseSchema1Test, and MediaWikiTestCaseSchema2Test.
Definition at line 504 of file MediaWikiTestCase.php.
References and(), needsDB(), Maintenance\setLBFactoryTriggers(), and wfRecursiveRemoveDir().
MediaWikiTestCase::setupAllTestDBs | ( | ) |
Set up all test DBs.
Definition at line 1426 of file MediaWikiTestCase.php.
References $wgDBprefix, CloneDatabase\changePrefix(), and dbPrefix().
Referenced by run().
|
static |
Reimplemented in ApiFormatXmlTest, MWDebugTest, GitInfoTest, LogFormatterTest, MediaWiki\Tests\Maintenance\DumpTestCase, and MediaWikiTestCaseTest.
Definition at line 163 of file MediaWikiTestCase.php.
|
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.
IMaintainableDatabase | $db | Database to use |
string | null | $prefix | Prefix to use for test tables. If not given, the prefix is determined automatically for $db. |
Definition at line 1388 of file MediaWikiTestCase.php.
References and(), Wikimedia\Rdbms\IDatabase\getType(), and Wikimedia\Rdbms\IDatabase\tablePrefix().
Referenced by MediaWiki\Tests\Maintenance\BackupDumperPageTest\newStreamingDBConnection(), and MediaWikiTestCaseTest\testCopyTestData().
|
staticprotected |
Clones the External Store database(s) for testing.
string | null | $testPrefix | Prefix for test tables. Will be determined automatically if not given. |
Definition at line 1500 of file MediaWikiTestCase.php.
|
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 1631 of file MediaWikiTestCase.php.
References and(), dropMockTables(), ensureMockDatabaseConnection(), getSchemaOverrides(), listOriginalTables(), mungeSchemaUpdateQuery(), Wikimedia\Rdbms\IMaintainableDatabase\sourceFile(), and undoSchemaOverrides().
Referenced by run().
|
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.
IMaintainableDatabase | $db | The database connection |
string | $prefix | The prefix to use for the new table set (aka schema). |
MWException | If the database table prefix is already $prefix |
Definition at line 1466 of file MediaWikiTestCase.php.
References Wikimedia\Rdbms\IDatabase\getType(), Wikimedia\Rdbms\IDatabase\query(), and Wikimedia\Rdbms\IDatabase\tablePrefix().
MediaWikiTestCase::setUserLang | ( | $lang | ) |
string | Language | $lang |
Definition at line 1057 of file MediaWikiTestCase.php.
References $lang, and setMwGlobals().
Referenced by MessageCacheTest\configureLanguages(), CategoryTest\setUp(), OldChangesListTest\setUp(), ExtraParserTest\setUp(), HtmlTest\setUp(), MessageTest\setUp(), ArticleViewTest\setUp(), MediaWikiTitleCodecTest\setUp(), TitleTest\setUp(), MediaWikiLangTestCase\setUp(), SpecialPageTest\testBuildPrevNextNavigation(), TitleTest\testGetPageViewLanguage(), MessageTest\testInContentLanguage(), MessageTest\testInContentLanguageOverride(), and ArticleTablesTest\testTemplatelinksUsesContentLanguage().
|
protected |
Stashes the global, will be restored in tearDown()
Individual test functions may override globals through the setMwGlobals() function or directly. When directly overriding globals their keys should first be passed to this method in setUp to avoid breaking global state for other tests
That way all other tests are executed with the same settings (instead of using the unreliable local settings for most tests and fix it only for some tests).
array | string | $globalKeys | Key to the global variable, or an array of keys. |
Definition at line 816 of file MediaWikiTestCase.php.
References doStashMwGlobals(), and wfDeprecated().
Referenced by MediaWikiTestCaseTest\testStashedGlobalsAreRestoredOnTearDown().
|
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.
mixed | &$r | The array to remove string keys from. |
Definition at line 2133 of file MediaWikiTestCase.php.
References and().
|
protected |
Reimplemented in CaptchaPreAuthenticationProviderTest, CaptchaTest, GadgetTest, SpamBlacklistTest, ApiQueryTitleBlacklistTest, WatchActionTest, ApiTestCase, AutoLoaderTest, MediaWiki\Tests\Block\BlockRestrictionStoreTest, ContentHandlerTest, TextContentTest, DeprecatedGlobalTest, MigrateFileRepoLayoutTest, StoreBatchTest, HtmlTest, JobQueueTest, PageDataRequestHandlerTest, LinkRendererTest, DatabaseLogEntryTest, WebPHandlerTest, MediaWikiTest, OutputPageTest, ArticleTest, WikiPageDbTestBase, ParserOptionsTest, ParserOutputTest, ParserPreloadTest, PrefixSearchTest, ResourceLoaderWikiModuleTest, SampleTest, SearchEnginePrefixTest, SearchEngineTest, AbstractChangesListSpecialPageTestCase, SpecialBlockTest, SpecialPageTestBase, MediaWiki\Tests\Storage\DerivedPageDataUpdaterTest, TitleMethodsTest, WebRequestTest, XmlSelectTest, XmlTest, LanguageClassesTestCase, LanguageConverterTest, MediaWiki\Tests\Maintenance\BackupDumperPageTest, MediaWiki\Tests\Maintenance\BaseDumpTest, MediaWiki\Tests\Maintenance\MaintenanceBaseTestCase, and DatabaseIntegrationTest.
Definition at line 547 of file MediaWikiTestCase.php.
References $GLOBALS, $value, $wgRequest, $wgSQLMode, and(), needsDB(), resetNamespaces(), restoreLoggers(), and wfRecursiveRemoveDir().
Referenced by MediaWikiTestCaseTest\testLoggersAreRestoredOnTearDown_replacingExistingLogger(), MediaWikiTestCaseTest\testLoggersAreRestoredOnTearDown_replacingNonExistingLogger(), MediaWikiTestCaseTest\testLoggersAreRestoredOnTearDown_replacingSameLoggerTwice(), MediaWikiTestCaseTest\testSetGlobalsAreRestoredOnTearDown(), MediaWikiTestCaseTest\testSetNonExistentGlobalsAreUnsetOnTearDown(), and MediaWikiTestCaseTest\testStashedGlobalsAreRestoredOnTearDown().
|
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.
Definition at line 1354 of file MediaWikiTestCase.php.
References $type, $wgJobClasses, and CloneDatabase\changePrefix().
|
final |
Make sure MediaWikiTestCase extending classes have called their parent setUp method.
With strict coverage activated in PHP_CodeCoverage, this test would be marked as risky without the following annotation (T152923). @coversNothing
Definition at line 634 of file MediaWikiTestCase.php.
References and().
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.
string | $tableName | |
IDatabase | null | $db |
Definition at line 1834 of file MediaWikiTestCase.php.
References and(), 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().
|
private |
Undoes the specified schema overrides.
Called once per test class, just before addDataOnce().
IMaintainableDatabase | $db | |
array | $oldOverrides |
Definition at line 1599 of file MediaWikiTestCase.php.
References and(), dropMockTables(), ensureMockDatabaseConnection(), listOriginalTables(), recloneMockTables(), and resetDB().
Referenced by setUpSchema().
|
staticprivate |
Definition at line 1862 of file MediaWikiTestCase.php.
References and().
MediaWikiTestCase::usesTemporaryTables | ( | ) |
|
static |
Used as a marker to prevent wfResetOutputBuffers from breaking PHPUnit.
string | $buffer |
Definition at line 2314 of file MediaWikiTestCase.php.
References $buffer.
|
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 47 of file MediaWikiTestCase.php.
Referenced by SpecialPageFactoryTest\testGetAliasListRecursion(), DeprecatedGlobalTest\testLazyLoad(), LBFactoryTest\testLBFactoryMultiRoundCallbacks(), MediaWiki\Session\SessionManagerTest\testLoadSessionInfoFromStore(), HTMLCheckMatrixTest\testValidateCallsUserDefinedValidationCallback(), and LoadBalancerTest\testWithoutReplica().
|
private |
The CLI arguments passed through from phpunit.php.
Definition at line 122 of file MediaWikiTestCase.php.
|
protected |
Primary database.
Definition at line 61 of file MediaWikiTestCase.php.
Referenced by LoadBalancerTest\assertWriteAllowed(), LoadBalancerTest\assertWriteForbidden(), 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\Maintenance\BackupDumperPageTest\newStreamingDBConnection(), MediaWiki\Tests\Revision\NoContentModelRevisionStoreDbTest\provideGetSlotsQueryInfo(), ActorMigrationTest\provideInsertRoundTrip(), CommentStoreTest\provideInsertRoundTrip(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\provideSlotsQueryInfo(), LBFactoryTest\quoteTable(), MediaWikiTestCaseTest\testCopyTestData(), 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(), LBFactoryTest\testInvalidSelectDBIndependant2(), WikiMapTest\testIsCurrentWikiId(), 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(), MediaWiki\Tests\Storage\NameTableStoreTest\testTransactionRollbackWithFailedRedo(), LBFactoryTest\testTrickyDomain(), ImportTest\testUnknownUserHandling(), MediaWiki\Tests\Block\BlockRestrictionStoreTest\testUpdateChange(), MediaWiki\Tests\Block\BlockRestrictionStoreTest\testUpdateInsert(), MediaWiki\Tests\Block\BlockRestrictionStoreTest\testUpdateNoRestrictions(), MediaWiki\Tests\Block\BlockRestrictionStoreTest\testUpdateSame(), and BatchRowUpdateTest\testWriterBasicFunctionality().
|
staticprivate |
Definition at line 71 of file MediaWikiTestCase.php.
|
private |
Holds original values of ini settings to be restored in tearDown().
Definition at line 110 of file MediaWikiTestCase.php.
|
private |
The local service locator, created during setUp().
Definition at line 33 of file MediaWikiTestCase.php.
|
private |
Holds original loggers which have been replaced by setLogger()
Definition at line 116 of file MediaWikiTestCase.php.
|
private |
Holds original values of MediaWiki configuration settings to be restored in tearDown().
See also setMwGlobals().
Definition at line 95 of file MediaWikiTestCase.php.
|
private |
Holds list of MediaWiki configuration settings to be unset in tearDown().
See also setMwGlobals().
Definition at line 102 of file MediaWikiTestCase.php.
|
staticprivate |
Definition at line 72 of file MediaWikiTestCase.php.
|
staticprivate |
The original service locator.
This is overridden during setUp().
Definition at line 27 of file MediaWikiTestCase.php.
|
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 129 of file MediaWikiTestCase.php.
|
private |
Original value of PHP's error_reporting setting.
Definition at line 79 of file MediaWikiTestCase.php.
|
staticprivate |
Definition at line 70 of file MediaWikiTestCase.php.
|
staticprivate |
Definition at line 1567 of file MediaWikiTestCase.php.
|
protected |
Definition at line 141 of file MediaWikiTestCase.php.
|
protected |
Definition at line 67 of file MediaWikiTestCase.php.
|
private |
Holds the paths of temporary files/directories created through getNewTempFile, and getNewTempDirectory.
Definition at line 87 of file MediaWikiTestCase.php.
Referenced by FileBackendTest\doTestGetLocalCopy(), and FileBackendTest\doTestGetLocalReference().
|
static |
Definition at line 53 of file MediaWikiTestCase.php.
Referenced by ApiQueryUserContribsTest\addDBDataOnce(), ApiQueryUserContribsTest\provideSorting(), SpecialBlockTest\testCheckUnblockSelf(), UserTest\testFindUsersByGroup(), and ActorMigrationTest\testGetWhere().
|
staticprivate |
Definition at line 69 of file MediaWikiTestCase.php.
const MediaWikiTestCase::DB_PREFIX = 'unittest_' |
const MediaWikiTestCase::ORA_DB_PREFIX = 'ut_' |
Definition at line 135 of file MediaWikiTestCase.php.