MediaWiki
REL1_20
|
Inherited by ArticleTest, BaseDumpTest, BitmapMetadataHandlerTest, BitmapScalingTest, CdbTest, CLDRPluralRuleEvaluatorTest, CleanUpTest, 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, LanguageAmTest, LanguageArTest, LanguageBeTaraskTest, LanguageBeTest, LanguageBhTest, LanguageBsTest, LanguageCsTest, LanguageCuTest, LanguageCyTest, LanguageDsbTest, LanguageFrTest, LanguageGaTest, LanguageGdTest, LanguageGvTest, LanguageHeTest, LanguageHiTest, LanguageHrTest, LanguageHsbTest, LanguageHuTest, LanguageHyTest, LanguageKshTest, LanguageLnTest, LanguageLtTest, LanguageLvTest, LanguageMgTest, LanguageMkTest, LanguageMlTest, LanguageMoTest, LanguageMtTest, LanguageNlTest, LanguageNsoTest, LanguagePlTest, LanguageRoTest, LanguageRuTest, LanguageSeTest, LanguageSgsTest, LanguageShTest, LanguageSkTest, LanguageSlTest, LanguageSmaTest, LanguageSrTest, LanguageTest, LanguageTiTest, LanguageTlTest, LanguageTrTest, LanguageUkTest, LanguageUzTest, LanguageWaTest, LicensesTest, LinksUpdateTest, LocalFileTest, LocalisationCacheTest, MagicVariableTest, MaintenanceTest, MediaHandlerTest, MediaWikiLangTestCase, MWDebugTest, MWFunctionTest, MWNamespaceTest, NewParserTest, ORMRowTest, ParserOptionsTest, ParserPreloadTest, PathRouterTest, PNGHandlerTest, PNGMetadataExtractorTest, PreferencesTest, PrefixUniquenessTest, PreprocessorTest, ProcessCacheLRUTest, QueryAllSpecialPagesTest, RecentChangeTest, ResourceLoaderTest, RevisionStorageTest, RevisionTest, SanitizerTest, SanitizerValidateEmailTest, SearchEngineTest, SearchUpdateTest, SeleniumConfigurationTest, ServicesJsonTest, SiteConfigurationTest, SpecialRecentchangesTest, SpecialSearchTest, StoreBatchTest, StructureTest, SVGMetadataExtractorTest, TagHookTest, 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 () | |
getNewTempDirectory () | |
obtains a new temporary directory | |
getNewTempFile () | |
obtains a new temporary file name | |
listTables () | |
objectAssociativeSort (array &$array) | |
Does an associative sort that works for objects. | |
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 | $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 44 of file MediaWikiTestCase.php.
MediaWikiTestCase::__call | ( | $ | func, |
$ | args | ||
) |
Reimplemented in MWNamespaceTest.
Definition at line 268 of file MediaWikiTestCase.php.
MediaWikiTestCase::addCoreDBData | ( | ) | [private] |
Definition at line 165 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 163 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 409 of file MediaWikiTestCase.php.
Referenced by GenericArrayObjectTest\instanceProvider().
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 430 of file MediaWikiTestCase.php.
MediaWikiTestCase::assertEmpty2 | ( | $ | value, |
$ | msg | ||
) | [private] |
Definition at line 286 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 459 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 369 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 536 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 516 of file MediaWikiTestCase.php.
MediaWikiTestCase::checkDbIsSupported | ( | ) | [protected] |
Definition at line 319 of file MediaWikiTestCase.php.
Definition at line 140 of file MediaWikiTestCase.php.
Referenced by DatabaseTest\prefixAndQuote().
MediaWikiTestCase::getCliArg | ( | $ | offset | ) |
Definition at line 325 of file MediaWikiTestCase.php.
Referenced by StoreBatchTest\setUp(), FileBackendTest\setUp(), NewParserTest\setUp(), NewParserTest\setupGlobals(), and NewParserTest\testFuzzTests().
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 107 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 93 of file MediaWikiTestCase.php.
Referenced by TextPassDumperTest\checkpointHelper(), TextPassDumperTest\setUpStub(), 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 345 of file MediaWikiTestCase.php.
Referenced by BlockTest\testBug29116LoadWithEmptyIp(), and RevisionStorageTest\testRevText().
MediaWikiTestCase::initDB | ( | ) | [private] |
Definition at line 221 of file MediaWikiTestCase.php.
static MediaWikiTestCase::isNotUnittest | ( | $ | table | ) | [static, private] |
Definition at line 295 of file MediaWikiTestCase.php.
MediaWikiTestCase::listTables | ( | ) | [protected] |
Definition at line 299 of file MediaWikiTestCase.php.
Definition at line 144 of file MediaWikiTestCase.php.
MediaWikiTestCase::objectAssociativeSort | ( | array &$ | array | ) | [protected] |
Does an associative sort that works for objects.
array | $array |
Definition at line 473 of file MediaWikiTestCase.php.
MediaWikiTestCase::resetDB | ( | ) | [private] |
Empty all tables so they can be repopulated for tests.
Definition at line 247 of file MediaWikiTestCase.php.
MediaWikiTestCase::run | ( | PHPUnit_Framework_TestResult $ | result = NULL | ) |
Definition at line 51 of file MediaWikiTestCase.php.
Referenced by HooksTest\testNewStyleHooks().
MediaWikiTestCase::setCliArg | ( | $ | offset, |
$ | value | ||
) |
Definition at line 333 of file MediaWikiTestCase.php.
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 491 of file MediaWikiTestCase.php.
MediaWikiTestCase::tearDown | ( | ) | [protected] |
Reimplemented in FileBackendTest, StoreBatchTest, SeleniumConfigurationTest, NewParserTest, UploadStashTest, ApiOptionsTest, TitlePermissionTest, MagicVariableTest, UserTest, HtmlTest, SearchUpdateTest, SideBarTest, WikiPageTest, XmlTest, ExifRotationTest, MediaWikiLangTestCase, MWNamespaceTest, LanguageSrTest, LanguageUzTest, ApiTestCaseUpload, FormatMetadataTest, CSSMinTest, ParserPreloadTest, LanguageConverterTest, UploadTest, RevisionTest, TestSample, MWDebugTest, BaseDumpTest, ArticleTest, LanguageRuTest, LanguageSkTest, LanguageSlTest, LanguageUkTest, ExifBitmapTest, ExifTest, ParserOptionsTest, LanguageAmTest, LanguageBeTest, LanguageBhTest, LanguageBsTest, LanguageCsTest, LanguageCuTest, LanguageCyTest, LanguageDsbTest, LanguageFrTest, LanguageGaTest, LanguageGdTest, LanguageGvTest, LanguageHeTest, LanguageHiTest, LanguageHrTest, LanguageHsbTest, LanguageHuTest, LanguageHyTest, LanguageKshTest, LanguageLnTest, LanguageLtTest, LanguageLvTest, LanguageMgTest, LanguageMkTest, LanguageMlTest, LanguageMoTest, LanguageMtTest, LanguageNlTest, LanguageNsoTest, LanguagePlTest, LanguageRoTest, LanguageSeTest, LanguageSgsTest, LanguageShTest, LanguageSmaTest, LanguageTiTest, LanguageTlTest, LanguageTrTest, LanguageWaTest, DatabaseTest, ExternalStoreTest, SpecialSearchTest, TimeAdjustTest, LanguageArTest, GlobalTest, JpegTest, BitmapScalingTest, TiffTest, LanguageTest, SearchEngineTest, WebRequestTest, XmlSelectTest, and LanguageBeTaraskTest.
Definition at line 120 of file MediaWikiTestCase.php.
static MediaWikiTestCase::unprefixTable | ( | $ | tableName | ) | [static, private] |
Definition at line 290 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.
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 37 of file MediaWikiTestCase.php.
MediaWikiTestCase::$tablesUsed = array() [protected] |
Definition at line 19 of file MediaWikiTestCase.php.
array MediaWikiTestCase::$tmpfiles = array() [private] |
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 35 of file MediaWikiTestCase.php.