MediaWiki
master
|
Inherited by ApiGeneratorTest, ArticleTest, BaseDumpTest, BitmapMetadataHandlerTest, BitmapScalingTest, CdbTest, CLDRPluralRuleEvaluatorTest, CleanUpTest, ContentHandlerTest, CssContentTest, CSSJanusTest, CSSMinTest, DatabaseSqliteTest, DatabaseSQLTest, DatabaseTest, DeviceDetectionTest, DiffHistoryBlobTest, DummyExtensionsTest, EditPageTest, ExifBitmapTest, ExifRotationTest, ExifTest, ExternalStoreTest, ExtraParserTest, FauxResponseTest, FetchTextTest, FileBackendTest, FileRepoTest, FormatMetadataTest, FormOptionsInitializationTest, FormOptionsTest, GenericArrayObjectTest, GetSlaveServerTest, GIFHandlerTest, GIFMetadataExtractorTest, GlobalTest, GlobalWithDBTest, HooksTest, HtmlTest, HttpTest, IEUrlExtensionTest, InstallDocFormatterTest, IPTCTest, IPTest, JavaScriptMinifierTest, JpegMetadataExtractorTest, JpegTest, JsonTest, LanguageClassesTestCase, LicensesTest, LinksUpdateTest, LocalFileTest, LocalisationCacheTest, MagicVariableTest, MaintenanceTest, MediaHandlerTest, MediaWikiLangTestCase, MWDebugTest, MWFunctionTest, MWNamespaceTest, NewParserTest, ORMRowTest, ORMTableTest, ParserOptionsTest, ParserOutputTest, ParserPreloadTest, PathRouterTest, PNGHandlerTest, PNGMetadataExtractorTest, PreferencesTest, PrefixUniquenessTest, PreprocessorTest, ProcessCacheLRUTest, QueryAllSpecialPagesTest, RecentChangeTest, RequestContextTest, ResourceLoaderTest, ResourcesTest, RevisionStorageTest, RevisionTest, SanitizerTest, SanitizerValidateEmailTest, SearchEngineTest, SearchUpdateTest, SeleniumConfigurationTest, ServicesJsonTest, SiteConfigurationTest, SiteListTest, SitesTest, SpecialRecentchangesTest, SpecialSearchTest, StoreBatchTest, StructureTest, SVGMetadataExtractorTest, TagHookTest, TextContentTest, TiffTest, TimestampTest, TitleMethodsTest, TitleTest, UploadStashTest, UploadTest, UserTest, WebRequestTest, wfAssembleUrl, wfBaseName, wfBCP47, wfExpandUrl, wfGetCaller, wfRemoveDotSegments, wfShorthandToIntegerTest, wfTimestamp, wfUrlencodeTest, XmlJs, XmlSelectTest, XmlTest, XMPTest, XMPValidateTest, and ZipDirectoryReaderTest.
Public Member Functions | |
__call ($func, $args) | |
__construct ($name=null, array $data=array(), $dataName= '') | |
addDBData () | |
Stub. | |
dbPrefix () | |
getCliArg ($offset) | |
hideDeprecated ($function) | |
Don't throw a warning if $function is deprecated and called later. | |
needsDB () | |
run (PHPUnit_Framework_TestResult $result=NULL) | |
setCliArg ($offset, $value) | |
Public Attributes | |
$regex = '' | |
$runDisabled = false | |
$suite | |
const | DB_PREFIX = 'unittest_' |
Table name prefixes. | |
const | ORA_DB_PREFIX = 'ut_' |
Static Public Attributes | |
static | $users |
Protected Member Functions | |
arrayWrap (array $elements) | |
Utility method taking an array of elements and wrapping each element in it's own array. | |
assertArrayEquals (array $expected, array $actual, $ordered=false, $named=false) | |
Assert that two arrays are equal. | |
assertHTMLEquals ($expected, $actual, $msg='') | |
Put each HTML element on its own line and then equals() the results. | |
assertSelect ($table, $fields, $condition, array $expectedRows) | |
Asserts that the given database query yields the rows given by $expectedRows. | |
assertType ($type, $actual, $message= '') | |
Asserts the type of the provided value. | |
assertTypeOrValue ($type, $actual, $value=false, $message= '') | |
Asserts that the provided variable is of the specified internal type or equals the $value argument. | |
checkDbIsSupported () | |
getDefaultWikitextNS () | |
Returns the ID of a namespace that defaults to Wikitext. | |
getNewTempDirectory () | |
obtains a new temporary directory | |
getNewTempFile () | |
obtains a new temporary file name | |
isWikitextNS ($ns) | |
Returns true iff the given namespace defaults to Wikitext according to $wgNamespaceContentModels. | |
listTables () | |
mergeMwGlobalArrayValue ($name, $values) | |
Merges the given values into a MW global array variable. | |
objectAssociativeSort (array &$array) | |
Does an associative sort that works for objects. | |
setMwGlobals ($pairs, $value=null) | |
setUp () | |
setUp and tearDown should (where significant) happen in reverse order. | |
tearDown () | |
Static Protected Member Functions | |
static | stripStringKeys (&$r) |
Utility function for eliminating all string keys from an array. | |
Protected Attributes | |
DatabaseBase | $db |
$oldTablePrefix | |
$reuseDB = false | |
$supportedDBs | |
$tablesUsed = array() | |
$useTemporaryTables = true | |
Private Member Functions | |
addCoreDBData () | |
assertEmpty2 ($value, $msg) | |
initDB () | |
resetDB () | |
Empty all tables so they can be repopulated for tests. | |
Static Private Member Functions | |
static | isNotUnittest ($table) |
static | unprefixTable ($tableName) |
Private Attributes | |
array | $mwGlobals = array() |
Holds original values of MediaWiki configuration settings to be restored in tearDown(). | |
array | $tmpfiles = array() |
Holds the paths of temporary files/directories created through getNewTempFile, and getNewTempDirectory. | |
Static Private Attributes | |
static | $dbSetup = false |
Definition at line 3 of file MediaWikiTestCase.php.
MediaWikiTestCase::__construct | ( | $ | name = null , |
array $ | data = array() , |
||
$ | dataName = '' |
||
) |
Reimplemented in RevisionStorageTest, WikiPageTest, and LinksUpdateTest.
Definition at line 50 of file MediaWikiTestCase.php.
Referenced by RevisionTestModifyableContent\__construct(), and RevisionTestModifyableContentHandler\__construct().
MediaWikiTestCase::__call | ( | $ | func, |
$ | args | ||
) |
Reimplemented in MWNamespaceTest.
Definition at line 396 of file MediaWikiTestCase.php.
MediaWikiTestCase::addCoreDBData | ( | ) | [private] |
Definition at line 292 of file MediaWikiTestCase.php.
Stub.
If a test needs to add additional data to the database, it should implement this method and do so
Reimplemented in FetchTextTest, NewParserTest, BackupDumperLoggerTest, SearchEngineTest, TextPassDumperTest, BlockTest, BackupDumperPageTest, ApiBlockTest, and GenderCacheTest.
Definition at line 290 of file MediaWikiTestCase.php.
MediaWikiTestCase::arrayWrap | ( | array $ | elements | ) | [protected] |
Utility method taking an array of elements and wrapping each element in it's own array.
Useful for data providers that only return a single argument.
array | $elements |
Definition at line 537 of file MediaWikiTestCase.php.
Referenced by SiteArrayTest\elementInstancesProvider(), GenericArrayObjectTest\instanceProvider(), SiteListTest\siteArrayProvider(), and SiteListTest\siteListProvider().
MediaWikiTestCase::assertArrayEquals | ( | array $ | expected, |
array $ | actual, | ||
$ | ordered = false , |
||
$ | named = false |
||
) | [protected] |
Assert that two arrays are equal.
By default this means that both arrays need to hold the same set of values. Using additional arguments, order and associated key can also be set as relevant.
array | $expected | |
array | $actual | |
boolean | $ordered | If the order of the values should match |
boolean | $named | If the keys should match |
Definition at line 558 of file MediaWikiTestCase.php.
Referenced by SiteListTest\testGetGlobalIdentifiers(), and TextContentTest\testGetParserOutput().
MediaWikiTestCase::assertEmpty2 | ( | $ | value, |
$ | msg | ||
) | [private] |
Definition at line 414 of file MediaWikiTestCase.php.
MediaWikiTestCase::assertHTMLEquals | ( | $ | expected, |
$ | actual, | ||
$ | msg = '' |
||
) | [protected] |
Put each HTML element on its own line and then equals() the results.
Use for nicely formatting of PHPUnit diff output when comparing very simple HTML
String | $expected | HTML on oneline |
String | $actual | HTML on oneline |
String | $msg | Optional message |
Definition at line 587 of file MediaWikiTestCase.php.
MediaWikiTestCase::assertSelect | ( | $ | table, |
$ | fields, | ||
$ | condition, | ||
array $ | expectedRows | ||
) | [protected] |
Asserts that the given database query yields the rows given by $expectedRows.
The expected rows should be given as indexed (not associative) arrays, with the values given in the order of the columns in the $fields parameter. Note that the rows are sorted by the columns given in $fields.
$table | String|Array the table(s) to query |
$fields | String|Array the columns to include in the result (and to sort by) |
$condition | String|Array "where" condition(s) |
$expectedRows | Array - an array of arrays giving the expected rows. |
MWException | if this test cases's needsDB() method doesn't return true. Test cases can use "@group Database" to enable database test support, or list the tables under testing in $this->tablesUsed, or override the needsDB() method. |
Definition at line 497 of file MediaWikiTestCase.php.
Referenced by LinksUpdateTest\assertLinksUpdate().
MediaWikiTestCase::assertType | ( | $ | type, |
$ | actual, | ||
$ | message = '' |
||
) | [protected] |
Asserts the type of the provided value.
This can be either in internal type such as boolean or integer, or a class or interface the value extends or implements.
string | $type | |
mixed | $actual | |
string | $message |
Definition at line 664 of file MediaWikiTestCase.php.
MediaWikiTestCase::assertTypeOrValue | ( | $ | type, |
$ | actual, | ||
$ | value = false , |
||
$ | message = '' |
||
) | [protected] |
Asserts that the provided variable is of the specified internal type or equals the $value argument.
This is useful for testing return types of functions that return a certain type or *value* when not set or on error.
string | $type | |
mixed | $actual | |
mixed | $value | |
string | $message |
Definition at line 644 of file MediaWikiTestCase.php.
MediaWikiTestCase::checkDbIsSupported | ( | ) | [protected] |
Definition at line 447 of file MediaWikiTestCase.php.
Definition at line 267 of file MediaWikiTestCase.php.
Referenced by DatabaseTest\prefixAndQuote().
MediaWikiTestCase::getCliArg | ( | $ | offset | ) |
Definition at line 453 of file MediaWikiTestCase.php.
Referenced by StoreBatchTest\setUp(), FileBackendTest\setUp(), NewParserTest\setUp(), NewParserTest\setupGlobals(), and NewParserTest\testFuzzTests().
MediaWikiTestCase::getDefaultWikitextNS | ( | ) | [protected] |
Returns the ID of a namespace that defaults to Wikitext.
Throws an MWException if there is none.
Definition at line 699 of file MediaWikiTestCase.php.
Referenced by TextPassDumperTest\addDBData(), RevisionStorageTest\createPage(), and WikiPageTest\newPage().
MediaWikiTestCase::getNewTempDirectory | ( | ) | [protected] |
obtains a new temporary directory
The obtained directory is enlisted to be removed (recursively with all its contained files) upon tearDown.
Definition at line 113 of file MediaWikiTestCase.php.
Referenced by TextPassDumperTest\checkpointHelper(), and ExifRotationTest\setUp().
MediaWikiTestCase::getNewTempFile | ( | ) | [protected] |
obtains a new temporary file name
The obtained filename is enlisted to be removed upon tearDown
Definition at line 99 of file MediaWikiTestCase.php.
Referenced by TextPassDumperTest\checkpointHelper(), TextPassDumperTest\setUpStub(), CdbTest\testCdb(), BackupDumperPageTest\testCurrentStubGzip(), BackupDumperPageTest\testCurrentStubPlain(), BackupDumperPageTest\testFullStubPlain(), BackupDumperPageTest\testFullTextPlain(), TextPassDumperTest\testPlain(), BackupDumperLoggerTest\testPlain(), TextPassDumperTest\testPrefetchPlain(), BackupDumperPageTest\testXmlDumpsBackupUseCase(), and BackupDumperLoggerTest\testXmlDumpsBackupUseCaseLogging().
MediaWikiTestCase::hideDeprecated | ( | $ | function | ) |
Don't throw a warning if $function is deprecated and called later.
$function | String |
Definition at line 473 of file MediaWikiTestCase.php.
Referenced by BlockTest\testBug29116LoadWithEmptyIp(), RevisionTest\testConstructWithContent(), RevisionTest\testConstructWithText(), WikiPageTest\testDoEdit(), WikiPageTest\testDoQuickEdit(), RevisionTest\testGetRawText(), WikiPageTest\testGetRawText(), RevisionTest\testGetText(), and WikiPageTest\testGetText().
MediaWikiTestCase::initDB | ( | ) | [private] |
Definition at line 349 of file MediaWikiTestCase.php.
static MediaWikiTestCase::isNotUnittest | ( | $ | table | ) | [static, private] |
Definition at line 423 of file MediaWikiTestCase.php.
MediaWikiTestCase::isWikitextNS | ( | $ | ns | ) | [protected] |
Returns true iff the given namespace defaults to Wikitext according to $wgNamespaceContentModels.
int | $ns | The namespace ID to check |
Definition at line 682 of file MediaWikiTestCase.php.
Referenced by SearchEngineTest\addDBData(), SearchEngineTest\fetchIds(), and NewParserTest\testParserTest().
MediaWikiTestCase::listTables | ( | ) | [protected] |
Definition at line 427 of file MediaWikiTestCase.php.
MediaWikiTestCase::mergeMwGlobalArrayValue | ( | $ | name, |
$ | values | ||
) | [protected] |
Merges the given values into a MW global array variable.
Useful for setting some entries in a configuration array, instead of setting the entire array.
String | $name | The name of the global, as in wgFooBar |
Array | $values | The array containing the entries to set in that global |
MWException | if the designated global is not an array. |
Definition at line 249 of file MediaWikiTestCase.php.
Referenced by RevisionTest\setUp(), and TitleMethodsTest\setup().
Definition at line 271 of file MediaWikiTestCase.php.
MediaWikiTestCase::objectAssociativeSort | ( | array &$ | array | ) | [protected] |
Does an associative sort that works for objects.
array | $array |
Definition at line 601 of file MediaWikiTestCase.php.
MediaWikiTestCase::resetDB | ( | ) | [private] |
Empty all tables so they can be repopulated for tests.
Definition at line 375 of file MediaWikiTestCase.php.
MediaWikiTestCase::run | ( | PHPUnit_Framework_TestResult $ | result = NULL | ) |
Definition at line 57 of file MediaWikiTestCase.php.
Referenced by HooksTest\testNewStyleHookInteraction(), and HooksTest\testNewStyleHooks().
MediaWikiTestCase::setCliArg | ( | $ | offset, |
$ | value | ||
) |
Definition at line 461 of file MediaWikiTestCase.php.
MediaWikiTestCase::setMwGlobals | ( | $ | pairs, |
$ | value = null |
||
) | [protected] |
Definition at line 219 of file MediaWikiTestCase.php.
Referenced by GlobalTest\setUp(), ExifTest\setUp(), FormatMetadataTest\setUp(), JpegTest\setUp(), TiffTest\setUp(), MessageTest\setUp(), BitmapMetadataHandlerTest\setUp(), TimeAdjustTest\setUp(), ExifBitmapTest\setUp(), SanitizerTest\setUp(), BitmapScalingTest\setUp(), HtmlTest\setUp(), XmlTest\setUp(), LanguageConverterTest\setUp(), RevisionTest\setUp(), ExtraParserTest\setUp(), MediaWikiLangTestCase\setUp(), TestSample\setUp(), ParserOptionsTest\setUp(), TimestampTest\setUp(), TitleTest\setUp(), LocalFileTest\setUp(), CSSMinTest\setUp(), CssContentTest\setUp(), ApiTestCaseUpload\setUp(), TextContentTest\setUp(), ContentHandlerTest\setup(), BlockTest\setUp(), MWNamespaceTest\setUp(), UserTest\setUp(), TagHookTest\setUp(), SearchUpdateTest\setUp(), PreferencesTest\setUp(), MagicVariableTest\setUp(), ExternalStoreTest\testExternalFetchFromURL(), and WikiPageTest\testIsCountable().
MediaWikiTestCase::setUp | ( | ) | [protected] |
setUp and tearDown should (where significant) happen in reverse order.
Reimplemented in FetchTextTest, MaintenanceTest, SeleniumConfigurationTest, TextPassDumperTest, LanguageClassesTestCase, BackupDumperPageTest, DumpTestCase, TestORMRowTest, FormOptionsInitializationTest, RevisionStorageTest, SideBarTest, MediaWikiSiteTest, SitesTest, WikiPageTest, NewParserTest, MagicVariableTest, FormOptionsTest, FauxResponseTest, LinksUpdateTest, SiteConfigurationTest, DatabaseSqliteTest, PreferencesTest, SearchUpdateTest, TitlePermissionTest, TagHookTest, UserTest, BlockTest, MWNamespaceTest, SearchEngineTest, ArticleTest, FileBackendTest, ApiOptionsTest, WikitextContentHandlerTest, ApiTestCaseUpload, TextContentTest, DatabaseSQLTest, JpegMetadataExtractorTest, ParserPreloadTest, RevisionTest_ContentHandlerUseDB, UploadStashTest, WikiPageTest_ContentHandlerUseDB, ApiTestCase, ApiWatchTest, CssContentTest, DatabaseTest, CSSMinTest, LocalFileTest, TitleTest, ApiBlockTest, ApiParseTest, ApiPurgeTest, ApiQueryTest, GenderCacheTest, CdbTest, UploadFromUrlTest, UploadTest, ExtraParserTest, StoreBatchTest, ExifRotationTest, PreprocessorTest, ParserOptionsTest, PathRouterTest, TestSample, TimestampTest, MediaWikiLangTestCase, LanguageConverterTest, RevisionTest, XmlSelectTest, XmlTest, MWDebugTest, HtmlTest, WebRequestTest, ZipDirectoryReaderTest, BitmapScalingTest, ExifBitmapTest, SVGMetadataExtractorTest, SanitizerTest, DiffHistoryBlobTest, GlobalTest, BitmapMetadataHandlerTest, ExifTest, FormatMetadataTest, GIFMetadataExtractorTest, GIFHandlerTest, JpegTest, PNGMetadataExtractorTest, PNGHandlerTest, TiffTest, XMPTest, MessageTest, and TimeAdjustTest.
Definition at line 130 of file MediaWikiTestCase.php.
Referenced by TitleMethodsTest\setup().
static MediaWikiTestCase::stripStringKeys | ( | &$ | r | ) | [static, protected] |
Utility function for eliminating all string keys from an array.
Useful to turn a database result row as returned by fetchRow() into a pure indexed array.
$r | mixed the array to remove string keys from. |
Definition at line 619 of file MediaWikiTestCase.php.
MediaWikiTestCase::tearDown | ( | ) | [protected] |
Reimplemented in SeleniumConfigurationTest, NewParserTest, LanguageClassesTestCase, RevisionStorageTest, MagicVariableTest, RevisionTest, StoreBatchTest, WikiPageTest, SideBarTest, ContentHandlerTest, ExifRotationTest, RevisionTest_ContentHandlerUseDB, WikiPageTest_ContentHandlerUseDB, UploadStashTest, SearchEngineTest, LanguageConverterTest, ApiTestCaseUpload, ParserPreloadTest, TestSample, GlobalTest, ArticleTest, UploadTest, MWDebugTest, BaseDumpTest, DatabaseTest, WebRequestTest, and XmlSelectTest.
Definition at line 161 of file MediaWikiTestCase.php.
Referenced by TitleMethodsTest\teardown().
static MediaWikiTestCase::unprefixTable | ( | $ | tableName | ) | [static, private] |
Definition at line 418 of file MediaWikiTestCase.php.
DatabaseBase MediaWikiTestCase::$db [protected] |
Reimplemented in DatabaseSqliteTest, and DatabaseTest.
Definition at line 15 of file MediaWikiTestCase.php.
MediaWikiTestCase::$dbSetup = false [static, private] |
Definition at line 21 of file MediaWikiTestCase.php.
Holds original values of MediaWiki configuration settings to be restored in tearDown().
See also setMwGlobal().
Definition at line 35 of file MediaWikiTestCase.php.
MediaWikiTestCase::$oldTablePrefix [protected] |
Definition at line 16 of file MediaWikiTestCase.php.
MediaWikiTestCase::$regex = '' |
Reimplemented in NewParserTest.
Definition at line 5 of file MediaWikiTestCase.php.
MediaWikiTestCase::$reuseDB = false [protected] |
Definition at line 18 of file MediaWikiTestCase.php.
MediaWikiTestCase::$runDisabled = false |
Reimplemented in NewParserTest.
Definition at line 6 of file MediaWikiTestCase.php.
MediaWikiTestCase::$suite |
Definition at line 4 of file MediaWikiTestCase.php.
MediaWikiTestCase::$supportedDBs [protected] |
array( 'mysql', 'sqlite', 'postgres', 'oracle' )
Definition at line 43 of file MediaWikiTestCase.php.
MediaWikiTestCase::$tablesUsed = array() [protected] |
Definition at line 19 of file MediaWikiTestCase.php.
Holds the paths of temporary files/directories created through getNewTempFile, and getNewTempDirectory.
Definition at line 28 of file MediaWikiTestCase.php.
MediaWikiTestCase::$users [static] |
Reimplemented in UploadStashTest.
Definition at line 11 of file MediaWikiTestCase.php.
MediaWikiTestCase::$useTemporaryTables = true [protected] |
Definition at line 17 of file MediaWikiTestCase.php.
const MediaWikiTestCase::DB_PREFIX = 'unittest_' |
const MediaWikiTestCase::ORA_DB_PREFIX = 'ut_' |
Definition at line 41 of file MediaWikiTestCase.php.