BlueSpice MediaWiki REL1_27
 All Classes Namespaces Files Functions Variables Groups Pages
MediaWikiTestCase Class Reference

Inherits PHPUnit_Framework_TestCase.

Inherited by ActionTest, ApiContinuationManagerTest, ApiDocumentationTest, ApiFormatTestBase, ApiMessageTest, ApiMobileViewTest, ApiModuleManagerTest, ApiParseExtenderTest, ApiResultTest, ArrayDiffFormatterTest, ArticleTest, AutoLoaderTest, BadTitleErrorTest, BagOStuffTest, BaseDumpTest, BatchRowUpdateTest, BitmapMetadataHandlerTest, BitmapScalingTest, BlueSpice\Tests\Utility\UrlTitleParserTest, BookshelfTreeParserTest, BotPasswordTest, BSPageTemplatesListTest, BSTasksApiSpecTest, CachingSiteStoreTest, CategoryMembershipChangeJobTest, CdnCacheUpdateTest, CentralIdLookupTest, ComposerJsonTest, ComposerLockTest, ConfigFactoryTest, ContainmentSetTest, ContentHandlerTest, CSSMinTest, DatabaseMysqlBaseTest, DatabaseSqliteTest, DatabaseSQLTest, DatabaseTest, DatabaseUpdaterTest, DBSiteStoreTest, DeferredUpdatesTest, DeviceDetectionTest, DifferenceEngineTest, DiffHistoryBlobTest, DiffOpTest, DiffTest, DummyExtensionsTest, EchoAbstractMapperTest, EchoAttributeManagerTest, EchoDiffParserTest, EchoDiscussionParserTest, EchoEmailFormatterTest, EchoEventMapperTest, EchoNotificationFormatterTest, EchoNotificationMapperTest, EchoNotificationTest, EchoTargetPageMapperTest, EchoTargetPageTest, EchoTitleLocalCacheTest, EchoUserLocatorTest, EchoUserNotificationGatewayTest, ErrorPageErrorTest, ExifTest, ExpressionTest, ExtensionProcessorTest, ExtensionRegistryTest, ExternalStoreTest, ExtraParserTest, FauxRequestTest, FauxResponseTest, FetchTextTest, FileBackendDBRepoWrapperTest, FileBackendTest, FileContentsHasherTest, FileRepoTest, FilteredSequentialIteratorTest, ForeignTitleTest, FormatJsonTest, FormOptionsInitializationTest, FormOptionsTest, GadgetsTest, GIFMetadataExtractorTest, GitInfoTest, GlobalTest, GlobalVarConfigTest, GlobalWithDBTest, HashConfigTest, HashSiteStoreTest, HooksTest, HtmlAutoCompleteSelectFieldTest, HtmlCheckMatrixTest, HTMLFormTest, HtmlTest, HttpErrorTest, HttpTest, ImageListPagerTest, ImportLinkCacheIntegrationTest, InlineDifferenceEngineTest, InstallDocFormatterTest, InterwikiTest, IPTCTest, JobQueueTest, JobTest, JpegMetadataExtractorTest, LanguageClassesTestCase, LBFactoryTest, LicensesTest, LocalFileTest, LocalIdLookupTest, LocalisationCacheTest, MagicVariableTest, MailAddressTest, MaintenanceTest, Maps\Test\MapsDistanceParserTest, MediaHandlerTest, MediaWiki\Auth\AbstractAuthenticationProviderTest, MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest, MediaWiki\Auth\AbstractPreAuthenticationProviderTest, MediaWiki\Auth\AbstractPrimaryAuthenticationProviderTest, MediaWiki\Auth\AbstractSecondaryAuthenticationProviderTest, MediaWiki\Auth\AuthenticationRequestTest, MediaWiki\Auth\AuthenticationRequestTestCase, MediaWiki\Auth\AuthenticationResponseTest, MediaWiki\Auth\AuthManagerTest, MediaWiki\Auth\AuthPluginPrimaryAuthenticationProviderTest, MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProviderTest, MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProviderTest, MediaWiki\Auth\LegacyHookPreAuthenticationProviderTest, MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest, MediaWiki\Auth\ResetPasswordSecondaryAuthenticationProviderTest, MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest, MediaWiki\Auth\ThrottlePreAuthenticationProviderTest, MediaWiki\Auth\ThrottlerTest, MediaWiki\Logger\LegacyLoggerTest, MediaWiki\Logger\Monolog\AvroFormatterTest, MediaWiki\Logger\Monolog\KafkaHandlerTest, MediaWiki\Logger\Monolog\LineFormatterTest, MediaWiki\Logger\MonologSpiTest, MediaWiki\Session\BotPasswordSessionProviderTest, MediaWiki\Session\CookieSessionProviderTest, MediaWiki\Session\ImmutableSessionProviderWithCookieTest, MediaWiki\Session\MetadataMergeExceptionTest, MediaWiki\Session\PHPSessionHandlerTest, MediaWiki\Session\SessionBackendTest, MediaWiki\Session\SessionIdTest, MediaWiki\Session\SessionInfoTest, MediaWiki\Session\SessionManagerTest, MediaWiki\Session\SessionProviderTest, MediaWiki\Session\SessionTest, MediaWiki\Session\TokenTest, MediaWiki\Session\UserInfoTest, MediaWikiLangTestCase, MediaWikiMediaTestCase, MediaWikiPageLinkRendererTest, MediaWikiTest, MediaWikiTestCaseTest, MediaWikiTitleCodecTest, MemcachedBagOStuffTest, MergeHistoryTest, MergeUserTest, MigrateFileRepoLayoutTest, MobileContextTest, MobileFormatterTest, MobileFrontendHooksTest, MobileSpecialPageTest, MovePageTest, MultiConfigTest, MultiWriteBagOStuffTest, MWCryptHashTest, MWCryptHKDFTest, MWDebugTest, MWEchoDbFactoryTest, MWEchoNotifUserTest, MWExceptionHandlerTest, MWExceptionTest, MWGrantsTest, MWNamespaceTest, NaiveForeignTitleFactoryTest, NaiveImportTitleFactoryTest, NamespaceAwareForeignTitleFactoryTest, NamespaceImportTitleFactoryTest, NewParserTest, NotificationControllerTest, NotificationsTest, OracleInstallerTest, OutputPageTest, PageHierarchyProviderTest, ParserOutputTest, ParserPreloadTest, PasswordPolicyChecksTest, PasswordTest, PasswordTestCase, PathRouterTest, PFFormPrinterTest, PNGMetadataExtractorTest, PoolCounterTest, PreferencesTest, PrefixUniquenessTest, PreprocessorTest, QueryAllSpecialPagesTest, ReadOnlyErrorTest, RecentChangeTest, RefreshLinksPartitionTest, ReplicatedBagOStuffTest, RepoGroupTest, RequestContextTest, ResourceLoaderTestCase, ResourcesTest, RevisionStorageTest, RevisionTest, SanitizerTest, Scribunto_LuaEnvironmentComparisonTest, Scribunto_LuaInterpreterTest, SearchUpdateTest, SFFormPrinterTest, SiteConfigurationTest, SiteListTest, SiteTest, SkinFactoryTest, SkinMinervaTest, SkinTemplateTest, SkinTest, SpecialBooksourcesTest, SpecialMIMESearchTest, SpecialMobileDiffTest, SpecialMyLanguageTest, SpecialPageAliasTest, SpecialPageFactoryTest, SpecialPageTest, SpecialPageTestBase, SpecialPreferencesTest, SpecialRecentchangesTest, SpecialSearchTest, StoreBatchTest, StructureTest, SubpageImportTitleFactoryTest, SuppressionMaintenanceTest, SVGMetadataExtractorTest, SwiftFileBackendTest, TagHookTest, TemplateParserTest, TestingAccessWrapperTest, ThrottledErrorTest, TidyTest, TiffTest, TitleTest, TitleValueTest, UploadBaseTest, UploadStashTest, UserArrayFromResultTest, UserNotLoggedInTest, UserPasswordPolicyTest, UserTest, WANObjectCacheTest, WatchedItemIntegrationTest, WatchedItemStoreIntegrationTest, WebPHandlerTest, WebRequestTest, WfAppendQueryTest, WfArrayPlus2dTest, WfAssembleUrlTest, WfBaseNameTest, WfBCP47Test, WfEscapeShellArgTest, WfExpandUrlTest, WfGetCallerTest, WfParseUrlTest, WfRemoveDotSegmentsTest, WfShellExecTest, WfShorthandToIntegerTest, WfThumbIsStandardTest, WfTimestampTest, WfUrlencodeTest, XmlSelectTest, XmlTest, XMPTest, and XMPValidateTest.

Collaboration diagram for MediaWikiTestCase:

Public Member Functions

 __construct ($name=null, array $data=[], $dataName= '')
 
 run (PHPUnit_Framework_TestResult $result=null)
 
 usesTemporaryTables ()
 
 testMediaWikiTestCaseParentSetupCalled ()
 
 setUserLang ($lang)
 
 setContentLang ($lang)
 
 dbPrefix ()
 
 needsDB ()
 
 addDBDataOnce ()
 
 addDBData ()
 
 setupAllTestDBs ()
 
 __call ($func, $args)
 
 getCliArg ($offset)
 
 setCliArg ($offset, $value)
 
 hideDeprecated ($function)
 
- Public Member Functions inherited from PHPUnit_Framework_TestCase
 __construct ($name=null, array $data=array(), $dataName= '')
 
 toString ()
 
 count ()
 
 getAnnotations ()
 
 getName ($withDataSet=true)
 
 getSize ()
 
 getActualOutput ()
 
 hasOutput ()
 
 expectOutputRegex ($expectedRegex)
 
 expectOutputString ($expectedString)
 
 hasPerformedExpectationsOnOutput ()
 
 hasExpectationOnOutput ()
 
 getExpectedException ()
 
 setExpectedException ($exceptionName, $exceptionMessage= '', $exceptionCode=null)
 
 setExpectedExceptionRegExp ($exceptionName, $exceptionMessageRegExp= '', $exceptionCode=null)
 
 setUseErrorHandler ($useErrorHandler)
 
 getStatus ()
 
 getStatusMessage ()
 
 hasFailed ()
 
 run (PHPUnit_Framework_TestResult $result=null)
 
 runBare ()
 
 setName ($name)
 
 setDependencies (array $dependencies)
 
 hasDependencies ()
 
 setDependencyInput (array $dependencyInput)
 
 setDisallowChangesToGlobalState ($disallowChangesToGlobalState)
 
 setBackupGlobals ($backupGlobals)
 
 setBackupStaticAttributes ($backupStaticAttributes)
 
 setRunTestInSeparateProcess ($runTestInSeparateProcess)
 
 setPreserveGlobalState ($preserveGlobalState)
 
 setInIsolation ($inIsolation)
 
 isInIsolation ()
 
 getResult ()
 
 setResult ($result)
 
 setOutputCallback ($callback)
 
 getTestResultObject ()
 
 setTestResultObject (PHPUnit_Framework_TestResult $result)
 
 getMock ($originalClassName, $methods=array(), array $arguments=array(), $mockClassName= '', $callOriginalConstructor=true, $callOriginalClone=true, $callAutoload=true, $cloneArguments=false, $callOriginalMethods=false, $proxyTarget=null)
 
 getMockBuilder ($className)
 
 getMockForAbstractClass ($originalClassName, array $arguments=array(), $mockClassName= '', $callOriginalConstructor=true, $callOriginalClone=true, $callAutoload=true, $mockedMethods=array(), $cloneArguments=false)
 
 getMockForTrait ($traitName, array $arguments=array(), $mockClassName= '', $callOriginalConstructor=true, $callOriginalClone=true, $callAutoload=true, $mockedMethods=array(), $cloneArguments=false)
 
 addToAssertionCount ($count)
 
 getNumAssertions ()
 

Static Public Member Functions

static teardownTestDB ()
 
static setupTestDB (DatabaseBase $db, $prefix)
 
static listTables ($db)
 
static assertTag ($matcher, $actual, $message= '', $isHtml=true)
 
static assertNotTag ($matcher, $actual, $message= '', $isHtml=true)
 
static wfResetOutputBuffersBarrier ($buffer)
 
- Static Public Member Functions inherited from PHPUnit_Framework_TestCase
static any ()
 
static never ()
 
static atLeast ($requiredInvocations)
 
static atLeastOnce ()
 
static once ()
 
static exactly ($count)
 
static atMost ($allowedInvocations)
 
static at ($index)
 
static returnValue ($value)
 
static returnValueMap (array $valueMap)
 
static returnArgument ($argumentIndex)
 
static returnCallback ($callback)
 
static returnSelf ()
 
static throwException (Exception $exception)
 
static onConsecutiveCalls ()
 
static setUpBeforeClass ()
 
static tearDownAfterClass ()
 
- Static Public Member Functions inherited from PHPUnit_Framework_Assert
static assertArrayHasKey ($key, $array, $message= '')
 
static assertArraySubset ($subset, $array, $strict=false, $message= '')
 
static assertArrayNotHasKey ($key, $array, $message= '')
 
static assertContains ($needle, $haystack, $message= '', $ignoreCase=false, $checkForObjectIdentity=true, $checkForNonObjectIdentity=false)
 
static assertAttributeContains ($needle, $haystackAttributeName, $haystackClassOrObject, $message= '', $ignoreCase=false, $checkForObjectIdentity=true, $checkForNonObjectIdentity=false)
 
static assertNotContains ($needle, $haystack, $message= '', $ignoreCase=false, $checkForObjectIdentity=true, $checkForNonObjectIdentity=false)
 
static assertAttributeNotContains ($needle, $haystackAttributeName, $haystackClassOrObject, $message= '', $ignoreCase=false, $checkForObjectIdentity=true, $checkForNonObjectIdentity=false)
 
static assertContainsOnly ($type, $haystack, $isNativeType=null, $message= '')
 
static assertContainsOnlyInstancesOf ($classname, $haystack, $message= '')
 
static assertAttributeContainsOnly ($type, $haystackAttributeName, $haystackClassOrObject, $isNativeType=null, $message= '')
 
static assertNotContainsOnly ($type, $haystack, $isNativeType=null, $message= '')
 
static assertAttributeNotContainsOnly ($type, $haystackAttributeName, $haystackClassOrObject, $isNativeType=null, $message= '')
 
static assertCount ($expectedCount, $haystack, $message= '')
 
static assertAttributeCount ($expectedCount, $haystackAttributeName, $haystackClassOrObject, $message= '')
 
static assertNotCount ($expectedCount, $haystack, $message= '')
 
static assertAttributeNotCount ($expectedCount, $haystackAttributeName, $haystackClassOrObject, $message= '')
 
static assertEquals ($expected, $actual, $message= '', $delta=0.0, $maxDepth=10, $canonicalize=false, $ignoreCase=false)
 
static assertAttributeEquals ($expected, $actualAttributeName, $actualClassOrObject, $message= '', $delta=0.0, $maxDepth=10, $canonicalize=false, $ignoreCase=false)
 
static assertNotEquals ($expected, $actual, $message= '', $delta=0.0, $maxDepth=10, $canonicalize=false, $ignoreCase=false)
 
static assertAttributeNotEquals ($expected, $actualAttributeName, $actualClassOrObject, $message= '', $delta=0.0, $maxDepth=10, $canonicalize=false, $ignoreCase=false)
 
static assertEmpty ($actual, $message= '')
 
static assertAttributeEmpty ($haystackAttributeName, $haystackClassOrObject, $message= '')
 
static assertNotEmpty ($actual, $message= '')
 
static assertAttributeNotEmpty ($haystackAttributeName, $haystackClassOrObject, $message= '')
 
static assertGreaterThan ($expected, $actual, $message= '')
 
static assertAttributeGreaterThan ($expected, $actualAttributeName, $actualClassOrObject, $message= '')
 
static assertGreaterThanOrEqual ($expected, $actual, $message= '')
 
static assertAttributeGreaterThanOrEqual ($expected, $actualAttributeName, $actualClassOrObject, $message= '')
 
static assertLessThan ($expected, $actual, $message= '')
 
static assertAttributeLessThan ($expected, $actualAttributeName, $actualClassOrObject, $message= '')
 
static assertLessThanOrEqual ($expected, $actual, $message= '')
 
static assertAttributeLessThanOrEqual ($expected, $actualAttributeName, $actualClassOrObject, $message= '')
 
static assertFileEquals ($expected, $actual, $message= '', $canonicalize=false, $ignoreCase=false)
 
static assertFileNotEquals ($expected, $actual, $message= '', $canonicalize=false, $ignoreCase=false)
 
static assertStringEqualsFile ($expectedFile, $actualString, $message= '', $canonicalize=false, $ignoreCase=false)
 
static assertStringNotEqualsFile ($expectedFile, $actualString, $message= '', $canonicalize=false, $ignoreCase=false)
 
static assertFileExists ($filename, $message= '')
 
static assertFileNotExists ($filename, $message= '')
 
static assertTrue ($condition, $message= '')
 
static assertNotTrue ($condition, $message= '')
 
static assertFalse ($condition, $message= '')
 
static assertNotFalse ($condition, $message= '')
 
static assertNotNull ($actual, $message= '')
 
static assertNull ($actual, $message= '')
 
static assertClassHasAttribute ($attributeName, $className, $message= '')
 
static assertClassNotHasAttribute ($attributeName, $className, $message= '')
 
static assertClassHasStaticAttribute ($attributeName, $className, $message= '')
 
static assertClassNotHasStaticAttribute ($attributeName, $className, $message= '')
 
static assertObjectHasAttribute ($attributeName, $object, $message= '')
 
static assertObjectNotHasAttribute ($attributeName, $object, $message= '')
 
static assertSame ($expected, $actual, $message= '')
 
static assertAttributeSame ($expected, $actualAttributeName, $actualClassOrObject, $message= '')
 
static assertNotSame ($expected, $actual, $message= '')
 
static assertAttributeNotSame ($expected, $actualAttributeName, $actualClassOrObject, $message= '')
 
static assertInstanceOf ($expected, $actual, $message= '')
 
static assertAttributeInstanceOf ($expected, $attributeName, $classOrObject, $message= '')
 
static assertNotInstanceOf ($expected, $actual, $message= '')
 
static assertAttributeNotInstanceOf ($expected, $attributeName, $classOrObject, $message= '')
 
static assertInternalType ($expected, $actual, $message= '')
 
static assertAttributeInternalType ($expected, $attributeName, $classOrObject, $message= '')
 
static assertNotInternalType ($expected, $actual, $message= '')
 
static assertAttributeNotInternalType ($expected, $attributeName, $classOrObject, $message= '')
 
static assertRegExp ($pattern, $string, $message= '')
 
static assertNotRegExp ($pattern, $string, $message= '')
 
static assertSameSize ($expected, $actual, $message= '')
 
static assertNotSameSize ($expected, $actual, $message= '')
 
static assertStringMatchesFormat ($format, $string, $message= '')
 
static assertStringNotMatchesFormat ($format, $string, $message= '')
 
static assertStringMatchesFormatFile ($formatFile, $string, $message= '')
 
static assertStringNotMatchesFormatFile ($formatFile, $string, $message= '')
 
static assertStringStartsWith ($prefix, $string, $message= '')
 
static assertStringStartsNotWith ($prefix, $string, $message= '')
 
static assertStringEndsWith ($suffix, $string, $message= '')
 
static assertStringEndsNotWith ($suffix, $string, $message= '')
 
static assertXmlFileEqualsXmlFile ($expectedFile, $actualFile, $message= '')
 
static assertXmlFileNotEqualsXmlFile ($expectedFile, $actualFile, $message= '')
 
static assertXmlStringEqualsXmlFile ($expectedFile, $actualXml, $message= '')
 
static assertXmlStringNotEqualsXmlFile ($expectedFile, $actualXml, $message= '')
 
static assertXmlStringEqualsXmlString ($expectedXml, $actualXml, $message= '')
 
static assertXmlStringNotEqualsXmlString ($expectedXml, $actualXml, $message= '')
 
static assertEqualXMLStructure (DOMElement $expectedElement, DOMElement $actualElement, $checkAttributes=false, $message= '')
 
static assertSelectCount ($selector, $count, $actual, $message= '', $isHtml=true)
 
static assertSelectRegExp ($selector, $pattern, $count, $actual, $message= '', $isHtml=true)
 
static assertSelectEquals ($selector, $content, $count, $actual, $message= '', $isHtml=true)
 
static assertTag ($matcher, $actual, $message= '', $isHtml=true)
 
static assertNotTag ($matcher, $actual, $message= '', $isHtml=true)
 
static assertThat ($value, PHPUnit_Framework_Constraint $constraint, $message= '')
 
static assertJson ($actualJson, $message= '')
 
static assertJsonStringEqualsJsonString ($expectedJson, $actualJson, $message= '')
 
static assertJsonStringNotEqualsJsonString ($expectedJson, $actualJson, $message= '')
 
static assertJsonStringEqualsJsonFile ($expectedFile, $actualJson, $message= '')
 
static assertJsonStringNotEqualsJsonFile ($expectedFile, $actualJson, $message= '')
 
static assertJsonFileNotEqualsJsonFile ($expectedFile, $actualFile, $message= '')
 
static assertJsonFileEqualsJsonFile ($expectedFile, $actualFile, $message= '')
 
static logicalAnd ()
 
static logicalOr ()
 
static logicalNot (PHPUnit_Framework_Constraint $constraint)
 
static logicalXor ()
 
static anything ()
 
static isTrue ()
 
static callback ($callback)
 
static isFalse ()
 
static isJson ()
 
static isNull ()
 
static attribute (PHPUnit_Framework_Constraint $constraint, $attributeName)
 
static contains ($value, $checkForObjectIdentity=true, $checkForNonObjectIdentity=false)
 
static containsOnly ($type)
 
static containsOnlyInstancesOf ($classname)
 
static arrayHasKey ($key)
 
static equalTo ($value, $delta=0.0, $maxDepth=10, $canonicalize=false, $ignoreCase=false)
 
static attributeEqualTo ($attributeName, $value, $delta=0.0, $maxDepth=10, $canonicalize=false, $ignoreCase=false)
 
static isEmpty ()
 
static fileExists ()
 
static greaterThan ($value)
 
static greaterThanOrEqual ($value)
 
static classHasAttribute ($attributeName)
 
static classHasStaticAttribute ($attributeName)
 
static objectHasAttribute ($attributeName)
 
static identicalTo ($value)
 
static isInstanceOf ($className)
 
static isType ($type)
 
static lessThan ($value)
 
static lessThanOrEqual ($value)
 
static matchesRegularExpression ($pattern)
 
static matches ($string)
 
static stringStartsWith ($prefix)
 
static stringContains ($string, $case=true)
 
static stringEndsWith ($suffix)
 
static countOf ($count)
 
static fail ($message= '')
 
static readAttribute ($classOrObject, $attributeName)
 
static getStaticAttribute ($className, $attributeName)
 
static getObjectAttribute ($object, $attributeName)
 
static markTestIncomplete ($message= '')
 
static markTestSkipped ($message= '')
 
static getCount ()
 
static resetCount ()
 

Public Attributes

const DB_PREFIX = 'unittest_'
 
const ORA_DB_PREFIX = 'ut_'
 

Static Public Attributes

static $users
 

Protected Member Functions

 getNewTempFile ()
 
 getNewTempDirectory ()
 
 setUp ()
 
 addTmpFiles ($files)
 
 tearDown ()
 
 setMwGlobals ($pairs, $value=null)
 
 stashMwGlobals ($globalKeys)
 
 mergeMwGlobalArrayValue ($name, $values)
 
 setLogger ($channel, LoggerInterface $logger)
 
 insertPage ($pageName, $text= 'Sample page for unit test.')
 
 checkDbIsSupported ()
 
 assertSelect ($table, $fields, $condition, array $expectedRows)
 
 arrayWrap (array $elements)
 
 assertArrayEquals (array $expected, array $actual, $ordered=false, $named=false)
 
 assertHTMLEquals ($expected, $actual, $msg= '')
 
 objectAssociativeSort (array &$array)
 
 assertTypeOrValue ($type, $actual, $value=false, $message= '')
 
 assertType ($type, $actual, $message= '')
 
 isWikitextNS ($ns)
 
 getDefaultWikitextNS ()
 
 markTestSkippedIfNoDiff3 ()
 
 checkHasGzip ()
 
 checkPHPExtension ($extName)
 
 assertValidHtmlSnippet ($html)
 
 assertValidHtmlDocument ($html)
 
- Protected Member Functions inherited from PHPUnit_Framework_TestCase
 setExpectedExceptionFromAnnotation ()
 
 setUseErrorHandlerFromAnnotation ()
 
 checkRequirements ()
 
 runTest ()
 
 verifyMockObjects ()
 
 iniSet ($varName, $newValue)
 
 setLocale ()
 
 getMockClass ($originalClassName, $methods=array(), array $arguments=array(), $mockClassName= '', $callOriginalConstructor=false, $callOriginalClone=true, $callAutoload=true, $cloneArguments=false)
 
 getMockFromWsdl ($wsdlFile, $originalClassName= '', $mockClassName= '', array $methods=array(), $callOriginalConstructor=true, array $options=array())
 
 getObjectForTrait ($traitName, array $arguments=array(), $traitClassName= '', $callOriginalConstructor=true, $callOriginalClone=true, $callAutoload=true, $cloneArguments=false)
 
 prophesize ($classOrInterface=null)
 
 getDataSetAsString ($includeData=true)
 
 createResult ()
 
 handleDependencies ()
 
 setUp ()
 
 assertPreConditions ()
 
 assertPostConditions ()
 
 tearDown ()
 
 onNotSuccessfulTest (Exception $e)
 
 prepareTemplate (Text_Template $template)
 
 getMockObjectGenerator ()
 

Static Protected Member Functions

static setupDatabaseWithTestPrefix (DatabaseBase $db, $prefix)
 
static setupExternalStoreTestDBs ($testPrefix)
 
static getExternalStoreDatabaseConnections ()
 
static isUsingExternalStoreDB ()
 
static stripStringKeys (&$r)
 

Protected Attributes

 $db
 
 $tablesUsed = []
 
 $supportedDBs
 
- Protected Attributes inherited from PHPUnit_Framework_TestCase
 $backupGlobals = null
 
 $backupGlobalsBlacklist = array()
 
 $backupStaticAttributes = null
 
 $backupStaticAttributesBlacklist = array()
 
 $runTestInSeparateProcess = null
 
 $preserveGlobalState = true
 

Detailed Description

Since
1.18

Member Function Documentation

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

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

See Also
addDBDataOnce()
resetDB()
Since
1.18
MediaWikiTestCase::addDBDataOnce ( )

Stub. If a test suite needs to add additional data to the database, it should implement this method and do so. This method is called once per test suite (i.e. once per class).

Note data added by this method may be removed by resetDB() depending on the contents of $tablesUsed.

To add additional data between test function runs, override prepareDB().

See Also
addDBData()
resetDB()
Since
1.27
MediaWikiTestCase::arrayWrap ( array  $elements)
protected

Utility method taking an array of elements and wrapping each element in its own array. Useful for data providers that only return a single argument.

Since
1.20
Parameters
array$elements
Returns
array
MediaWikiTestCase::assertArrayEquals ( array  $expected,
array  $actual,
  $ordered = false,
  $named = false 
)
protected

Assert that two arrays are equal. By default this means that both arrays need to hold the same set of values. Using additional arguments, order and associated key can also be set as relevant.

Since
1.20
Parameters
array$expected
array$actual
bool$orderedIf the order of the values should match
bool$namedIf the keys should match
MediaWikiTestCase::assertHTMLEquals (   $expected,
  $actual,
  $msg = '' 
)
protected

Put each HTML element on its own line and then equals() the results

Use for nicely formatting of PHPUnit diff output when comparing very simple HTML

Since
1.20
Parameters
string$expectedHTML on oneline
string$actualHTML on oneline
string$msgOptional message
static MediaWikiTestCase::assertNotTag (   $matcher,
  $actual,
  $message = '',
  $isHtml = true 
)
static
See Also
MediaWikiTestCase::assertTag
Deprecated:
Parameters
array$matcher
string$actual
string$message
bool$isHtml
MediaWikiTestCase::assertSelect (   $table,
  $fields,
  $condition,
array  $expectedRows 
)
protected

Asserts that the given database query yields the rows given by $expectedRows. The expected rows should be given as indexed (not associative) arrays, with the values given in the order of the columns in the $fields parameter. Note that the rows are sorted by the columns given in $fields.

Since
1.20
Parameters
string | array$tableThe table(s) to query
string | array$fieldsThe columns to include in the result (and to sort by)
string | array$condition"where" condition(s)
array$expectedRowsAn array of arrays giving the expected rows.
Exceptions
MWExceptionIf this test cases's needsDB() method doesn't return true. Test cases can use "@group Database" to enable database test support, or list the tables under testing in $this->tablesUsed, or override the needsDB() method.
static MediaWikiTestCase::assertTag (   $matcher,
  $actual,
  $message = '',
  $isHtml = true 
)
static

Note: we are overriding this method to remove the deprecated error

See Also
https://phabricator.wikimedia.org/T71505
https://github.com/sebastianbergmann/phpunit/issues/1292
Deprecated:
Parameters
array$matcher
string$actual
string$message
bool$isHtml
MediaWikiTestCase::assertType (   $type,
  $actual,
  $message = '' 
)
protected

Asserts the type of the provided value. This can be either in internal type such as boolean or integer, or a class or interface the value extends or implements.

Since
1.20
Parameters
string$type
mixed$actual
string$message
MediaWikiTestCase::assertTypeOrValue (   $type,
  $actual,
  $value = false,
  $message = '' 
)
protected

Asserts that the provided variable is of the specified internal type or equals the $value argument. This is useful for testing return types of functions that return a certain type or value when not set or on error.

Since
1.20
Parameters
string$type
mixed$actual
mixed$value
string$message
MediaWikiTestCase::assertValidHtmlDocument (   $html)
protected

Asserts that the given string is valid HTML document.

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

Asserts that the given string is a valid HTML snippet. Wraps the given string in the required top level tags and then calls assertValidHtmlDocument(). The snippet is expected to be HTML 5.

Since
1.23
Note
Will mark the test as skipped if the "tidy" module is not installed.
This ignores $wgUseTidy, so we can check for valid HTML even (and especially) when automatic tidying is disabled.
Parameters
string$htmlAn HTML snippet (treated as the contents of the body tag).
MediaWikiTestCase::checkDbIsSupported ( )
protected
Exceptions
MWException
Since
1.18
MediaWikiTestCase::checkHasGzip ( )
protected

Check whether we have the 'gzip' commandline utility, will skip the test whenever "gzip -V" fails.

Result is cached at the process level.

Returns
bool
Since
1.21
MediaWikiTestCase::checkPHPExtension (   $extName)
protected

Check if $extName is a loaded PHP extension, will skip the test whenever it is not loaded.

Since
1.21
Parameters
string$extName
Returns
bool
MediaWikiTestCase::dbPrefix ( )
Returns
string
Since
1.18
MediaWikiTestCase::getCliArg (   $offset)
Since
1.18
Parameters
string$offset
Returns
mixed
MediaWikiTestCase::getDefaultWikitextNS ( )
protected

Returns the ID of a namespace that defaults to Wikitext.

Exceptions
MWExceptionIf there is none.
Returns
int The ID of the wikitext Namespace
Since
1.21
static MediaWikiTestCase::getExternalStoreDatabaseConnections ( )
staticprotected

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

Returns
array Array of DatabaseBase master connections
MediaWikiTestCase::getNewTempDirectory ( )
protected

obtains a new temporary directory

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

Since
1.20
Returns
string Absolute name of the temporary directory
MediaWikiTestCase::getNewTempFile ( )
protected

Obtains a new temporary file name

The obtained filename is enlisted to be removed upon tearDown

Since
1.20
Returns
string Absolute name of the temporary file
MediaWikiTestCase::hideDeprecated (   $function)

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

Since
1.19
Parameters
string$function
MediaWikiTestCase::insertPage (   $pageName,
  $text = 'Sample page for unit test.' 
)
protected

Insert a new page.

Should be called from addDBData().

Since
1.25
Parameters
string$pageNamePage name
string$textPage's content
Returns
array Title object and page id
static MediaWikiTestCase::isUsingExternalStoreDB ( )
staticprotected

Check whether ExternalStoreDB is being used

Returns
bool True if it's being used
MediaWikiTestCase::isWikitextNS (   $ns)
protected

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

Parameters
int$nsThe namespace ID to check
Returns
bool
Since
1.21
static MediaWikiTestCase::listTables (   $db)
static
Since
1.18
Parameters
DatabaseBase$db
Returns
array
MediaWikiTestCase::markTestSkippedIfNoDiff3 ( )
protected

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

Since
1.21
MediaWikiTestCase::mergeMwGlobalArrayValue (   $name,
  $values 
)
protected

Merges the given values into a MW global array variable. Useful for setting some entries in a configuration array, instead of setting the entire array.

Parameters
string$nameThe name of the global, as in wgFooBar
array$valuesThe array containing the entries to set in that global
Exceptions
MWExceptionIf the designated global is not an array.
Since
1.21
MediaWikiTestCase::needsDB ( )
Returns
bool
Since
1.18
MediaWikiTestCase::objectAssociativeSort ( array &  $array)
protected

Does an associative sort that works for objects.

Since
1.20
Parameters
array$array
MediaWikiTestCase::run ( PHPUnit_Framework_TestResult  $result = null)

Runs a test and collects its result in a TestResult instance.

Parameters
PHPUnit_Framework_TestResult$result
Returns
PHPUnit_Framework_TestResult

Implements PHPUnit_Framework_Test.

MediaWikiTestCase::setCliArg (   $offset,
  $value 
)
Since
1.18
Parameters
string$offset
mixed$value
MediaWikiTestCase::setContentLang (   $lang)
Since
1.27
Parameters
string | Language$lang
MediaWikiTestCase::setLogger (   $channel,
LoggerInterface  $logger 
)
protected

Sets the logger for a specified channel, for the duration of the test.

Since
1.27
Parameters
string$channel
LoggerInterface$logger
MediaWikiTestCase::setupAllTestDBs ( )

Set up all test DBs

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

Setups a database with the given prefix.

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

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

Parameters
DatabaseBase$dbDatabase to use
string$prefixPrefix to use for test tables
Returns
bool True if tables were cloned, false if only the prefix was changed
static MediaWikiTestCase::setupExternalStoreTestDBs (   $testPrefix)
staticprotected

Clones the External Store database(s) for testing

Parameters
string$testPrefixPrefix for test tables
static MediaWikiTestCase::setupTestDB ( DatabaseBase  $db,
  $prefix 
)
static

Creates an empty skeleton of the wiki database by cloning its structure to equivalent tables using the given $prefix. Then sets MediaWiki to use the new set of tables (aka schema) instead of the original set.

This is used to generate a dummy table set, typically consisting of temporary tables, that will be used by tests instead of the original wiki database tables.

Since
1.21
Note
the original table prefix is stored in self::$oldTablePrefix. This is used by teardownTestDB() to return the wiki to using the original table set.
this method only works when first called. Subsequent calls have no effect, even if using different parameters.
Parameters
DatabaseBase$dbThe database connection
string$prefixThe prefix to use for the new table set (aka schema).
Exceptions
MWExceptionIf the database table prefix is already $prefix
MediaWikiTestCase::setUserLang (   $lang)
Since
1.27
Parameters
string | Language$lang
MediaWikiTestCase::stashMwGlobals (   $globalKeys)
protected

Stashes the global, will be restored in tearDown()

Individual test functions may override globals through the setMwGlobals() function or directly. When directly overriding globals their keys should first be passed to this method in setUp to avoid breaking global state for other tests

That way all other tests are executed with the same settings (instead of using the unreliable local settings for most tests and fix it only for some tests).

Parameters
array | string$globalKeysKey to the global variable, or an array of keys.
Exceptions
ExceptionWhen trying to stash an unset global
Since
1.23
static MediaWikiTestCase::stripStringKeys ( $r)
staticprotected

Utility function for eliminating all string keys from an array. Useful to turn a database result row as returned by fetchRow() into a pure indexed array.

Since
1.20
Parameters
mixed$rThe array to remove string keys from.
static MediaWikiTestCase::teardownTestDB ( )
static

Restores MediaWiki to using the table set (table prefix) it was using before setupTestDB() was called. Useful if we need to perform database operations after the test run has finished (such as saving logs or profiling info).

Since
1.21
MediaWikiTestCase::testMediaWikiTestCaseParentSetupCalled ( )
final

Make sure MediaWikiTestCase extending classes have called their parent setUp method

MediaWikiTestCase::usesTemporaryTables ( )
Since
1.21
Returns
bool
static MediaWikiTestCase::wfResetOutputBuffersBarrier (   $buffer)
static

Used as a marker to prevent wfResetOutputBuffers from breaking PHPUnit.

Returns
string

Member Data Documentation

MediaWikiTestCase::$supportedDBs
protected
Initial value:
= [
'mysql',
'sqlite',
'postgres',
'oracle'
]
const MediaWikiTestCase::DB_PREFIX = 'unittest_'

Table name prefixes. Oracle likes it shorter.


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