MediaWiki REL1_28
FileBackendTest Class Reference

FileRepo FileBackend medium. More...

Inheritance diagram for FileBackendTest:
Collaboration diagram for FileBackendTest:

Public Member Functions

 assertBackendPathsConsistent (array $paths)
 assertGoodStatus (StatusValue $status, $msg)
 doTestGetLocalCopyAndReference404 ()
 tearDownFiles ()
 testAsyncWrites ()
 testConcatenate ( $op, $srcs, $srcsContent, $alreadyExists, $okStatus)
 testCopy ( $op)
 provider_testCopy FileBackend::doOperation
 testCreate ( $op, $alreadyExists, $okStatus, $newSize)
 provider_testCreate FileBackend::doOperation
 testDelete ( $op, $withSource, $okStatus)
 provider_testDelete FileBackend::doOperation
 testDescribe ( $op, $withSource, $okStatus)
 provider_testDescribe FileBackend::doOperation
 testDoOperations ()
 testDoOperationsFailing ()
 testDoOperationsPipeline ()
 testDoQuickOperations ()
 testExtensionFromPath ( $path, $res)
 provider_testExtensionFromPath FileBackend::extensionFromPath
 testGetContentType ( $mimeCallback, $mimeFromString)
 testGetDirectoryList ()
 FileBackend::getTopDirectoryList FileBackend::getDirectoryList.
 testGetFileContents ( $source, $content)
 provider_testGetFileContents FileBackend::getFileContents FileBackend::getFileContentsMulti
 testGetFileHttpUrl ( $source, $content)
 provider_testGetFileHttpUrl FileBackend::getFileHttpUrl
 testGetFileList ()
 testGetFileStat ( $path, $content, $alreadyExists)
 provider_testGetFileStat FileBackend::getFileStat
 testGetLocalCopy ( $source, $content)
 provider_testGetLocalCopy FileBackend::getLocalCopy
 testGetLocalCopyAndReference404 ()
 FileBackend::getLocalCopy FileBackend::getLocalReference.
 testGetLocalReference ( $source, $content)
 provider_testGetLocalReference FileBackend::getLocalReference
 testIsStoragePath ( $path, $isStorePath)
 provider_testIsStoragePath FileBackend::isStoragePath
 testLockCalls ()
 FileBackend::lockFiles FileBackend::unlockFiles.
 testMove ( $op)
 provider_testMove FileBackend::doOperation
 testNormalizeStoragePath ( $path, $res)
 provider_normalizeStoragePath FileBackend::normalizeStoragePath
 testParentStoragePath ( $path, $res)
 provider_testParentStoragePath FileBackend::parentStoragePath
 testPrepareAndClean ( $path, $isOK)
 provider_testPrepareAndClean FileBackend::prepare FileBackend::clean
 testReadAffinity ()
 testRecursiveClean ()
 testSanitizeOpHeaders ()
 testSplitStoragePath ( $path, $res)
 provider_testSplitStoragePath FileBackend::splitStoragePath
 testStore ( $op)
 testStreamFile ( $path, $content, $alreadyExists)
 provider_testGetFileStat FileBackend::streamFile
 testStreamFileRange ()
- Public Member Functions inherited from MediaWikiTestCase
 __call ( $func, $args)
 __construct ( $name=null, array $data=[], $dataName='')
 __destruct ()
 addDBData ()
 addDBDataOnce ()
 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)
 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 provider_normalizeStoragePath ()
static provider_testConcatenate ()
static provider_testCopy ()
static provider_testCreate ()
static provider_testDelete ()
static provider_testDescribe ()
static provider_testExtensionFromPath ()
static provider_testGetContentType ()
static provider_testGetFileContents ()
static provider_testGetFileHttpUrl ()
static provider_testGetFileStat ()
static provider_testGetLocalCopy ()
static provider_testGetLocalReference ()
static provider_testIsStoragePath ()
static provider_testMove ()
static provider_testParentStoragePath ()
static provider_testPrepareAndClean ()
static provider_testSplitStoragePath ()
static provider_testStore ()
static provider_testStreamFile ()
- Static Public Member Functions inherited from MediaWikiTestCase
static assertNotTag ( $matcher, $actual, $message='', $isHtml=true)
static assertTag ( $matcher, $actual, $message='', $isHtml=true)
 Note: we are overriding this method to remove the deprecated error.
static getMutableTestUser ( $groups=[])
 Convenience method for getting a mutable test user.
static getTestSysop ()
 Convenience method for getting an immutable admin test user.
static getTestUser ( $groups=[])
 Convenience method for getting an immutable test user.
static listTables (Database $db)
static prepareServices (Config $bootstrapConfig)
 Prepare service configuration for unit testing.
static setUpBeforeClass ()
static setupTestDB (Database $db, $prefix)
 Creates an empty skeleton of the wiki database by cloning its structure to equivalent tables using the given $prefix.
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

FSFileBackend $singleBackend
- Public Attributes inherited from MediaWikiTestCase
const DB_PREFIX = 'unittest_'
 Table name prefixes.
const ORA_DB_PREFIX = 'ut_'

Protected Member Functions

 setUp ()
- Protected Member Functions inherited from MediaWikiTestCase
 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.
 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.
 assertValidHtmlDocument ( $html)
 Asserts that the given string is valid HTML document.
 assertValidHtmlSnippet ( $html)
 Asserts that the given string is a valid HTML snippet.
 checkDbIsSupported ()
 checkPHPExtension ( $extName)
 Check if $extName is a loaded PHP extension, will skip the test whenever it is not loaded.
 getDefaultWikitextNS ()
 Returns the ID of a namespace that defaults to Wikitext.
 getNewTempDirectory ()
 obtains a new temporary directory
 getNewTempFile ()
 Obtains a new temporary file name.
 insertPage ( $pageName, $text='Sample page for unit test.', $namespace=null)
 Insert a new page.
 isWikitextNS ( $ns)
 Returns true if the given namespace defaults to Wikitext according to $wgNamespaceContentModels.
 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.
 setLogger ( $channel, LoggerInterface $logger)
 Sets the logger for a specified channel, for the duration of the test.
 setMwGlobals ( $pairs, $value=null)
 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.
 stashMwGlobals ( $globalKeys)
 Stashes the global, will be restored in tearDown()
 tearDown ()

Private Member Functions

 assertHasHeaders (array $headers, array $attr)
 backendClass ()
 create (array $params)
 deleteFiles ( $container)
 doTestConcatenate ( $params, $srcs, $srcsContent, $alreadyExists, $okStatus)
 doTestCopy ( $op)
 doTestCreate ( $op, $alreadyExists, $okStatus, $newSize)
 doTestDelete ( $op, $withSource, $okStatus)
 doTestDescribe ( $op, $withSource, $okStatus)
 doTestDoOperations ()
 doTestDoOperationsFailing ()
 doTestDoOperationsPipeline ()
 doTestDoQuickOperations ()
 doTestGetDirectoryList ()
 doTestGetFileContents ( $source, $content)
 doTestGetFileHttpUrl ( $source, $content)
 doTestGetFileList ()
 doTestGetFileStat ( $path, $content, $alreadyExists)
 doTestGetLocalCopy ( $source, $content)
 doTestGetLocalReference ( $source, $content)
 doTestLockCalls ()
 doTestMove ( $op)
 doTestPrepareAndClean ( $path, $isOK)
 doTestRecursiveClean ()
 doTestStore ( $op)
 doTestStreamFile ( $path, $content)
 doTestStreamFileRange ()
 listToArray ( $iter)
 prepare (array $params)

Static Private Member Functions

static baseStorePath ()

Private Attributes

FileBackend $backend
FileBackendMultiWrite $multiBackend

Static Private Attributes

static $backendToUse

Additional Inherited Members

- Static Public Attributes inherited from MediaWikiTestCase
static TestUser[] $users
- Static Protected Member Functions inherited from MediaWikiTestCase
static getExternalStoreDatabaseConnections ()
 Gets master database connections for all of the ExternalStoreDB stores configured in $wgDefaultExternalStore.
static isUsingExternalStoreDB ()
 Check whether ExternalStoreDB is being used.
static resetGlobalServices (Config $bootstrapConfig=null)
 Reset global services, and install testing environment.
static setupDatabaseWithTestPrefix (Database $db, $prefix)
 Setups a database with the given prefix.
static setupExternalStoreTestDBs ( $testPrefix)
 Clones the External Store database(s) for testing.
static stripStringKeys (&$r)
 Utility function for eliminating all string keys from an array.
- Protected Attributes inherited from MediaWikiTestCase
Database $db
 Primary database.
array $supportedDBs
array $tablesUsed = []

Detailed Description

FileRepo FileBackend medium.

Definition at line 8 of file FileBackendTest.php.

Member Function Documentation

◆ assertBackendPathsConsistent()

FileBackendTest::assertBackendPathsConsistent ( array  $paths)

◆ assertGoodStatus()

◆ assertHasHeaders()

FileBackendTest::assertHasHeaders ( array  $headers,
array  $attr 

Definition at line 687 of file FileBackendTest.php.

References as.

Referenced by doTestDescribe().

◆ backendClass()

◆ baseStorePath()

◆ create()

FileBackendTest::create ( array  $params)

Definition at line 2617 of file FileBackendTest.php.

References $params.

◆ deleteFiles()

FileBackendTest::deleteFiles (   $container)

Definition at line 2630 of file FileBackendTest.php.

References $base, as, and baseStorePath().

Referenced by tearDownFiles().

◆ doTestConcatenate()

FileBackendTest::doTestConcatenate (   $params,

◆ doTestCopy()

FileBackendTest::doTestCopy (   $op)

◆ doTestCreate()

FileBackendTest::doTestCreate (   $op,

◆ doTestDelete()

FileBackendTest::doTestDelete (   $op,

◆ doTestDescribe()

FileBackendTest::doTestDescribe (   $op,

◆ doTestDoOperations()

FileBackendTest::doTestDoOperations ( )

Definition at line 1691 of file FileBackendTest.php.

References $base, $status, assertGoodStatus(), baseStorePath(), create, and prepare().

Referenced by testDoOperations().

◆ doTestDoOperationsFailing()

FileBackendTest::doTestDoOperationsFailing ( )

Definition at line 1880 of file FileBackendTest.php.

References $base, $status, baseStorePath(), create, and prepare().

Referenced by testDoOperationsFailing().

◆ doTestDoOperationsPipeline()

FileBackendTest::doTestDoOperationsPipeline ( )

◆ doTestDoQuickOperations()

FileBackendTest::doTestDoQuickOperations ( )

◆ doTestGetDirectoryList()

FileBackendTest::doTestGetDirectoryList ( )

◆ doTestGetFileContents()

FileBackendTest::doTestGetFileContents (   $source,

◆ doTestGetFileHttpUrl()

FileBackendTest::doTestGetFileHttpUrl (   $source,

Definition at line 1516 of file FileBackendTest.php.

References $content, $source, $status, assertGoodStatus(), backendClass(), and prepare().

Referenced by testGetFileHttpUrl().

◆ doTestGetFileList()

FileBackendTest::doTestGetFileList ( )

◆ doTestGetFileStat()

FileBackendTest::doTestGetFileStat (   $path,

◆ doTestGetLocalCopy()

FileBackendTest::doTestGetLocalCopy (   $source,

◆ doTestGetLocalCopyAndReference404()

FileBackendTest::doTestGetLocalCopyAndReference404 ( )

Definition at line 1486 of file FileBackendTest.php.

References $base, backendClass(), and baseStorePath().

Referenced by testGetLocalCopyAndReference404().

◆ doTestGetLocalReference()

FileBackendTest::doTestGetLocalReference (   $source,

◆ doTestLockCalls()

FileBackendTest::doTestLockCalls ( )

◆ doTestMove()

FileBackendTest::doTestMove (   $op)

◆ doTestPrepareAndClean()

FileBackendTest::doTestPrepareAndClean (   $path,

Definition at line 1571 of file FileBackendTest.php.

References $path, $status, assertGoodStatus(), backendClass(), and prepare().

Referenced by testPrepareAndClean().

◆ doTestRecursiveClean()

FileBackendTest::doTestRecursiveClean ( )

◆ doTestStore()

FileBackendTest::doTestStore (   $op)

◆ doTestStreamFile()

FileBackendTest::doTestStreamFile (   $path,

Definition at line 1149 of file FileBackendTest.php.

References $content, $path, $status, assertGoodStatus(), backendClass(), create, and prepare().

Referenced by testStreamFile().

◆ doTestStreamFileRange()

FileBackendTest::doTestStreamFileRange ( )

◆ listToArray()

FileBackendTest::listToArray (   $iter)

Definition at line 2607 of file FileBackendTest.php.

Referenced by doTestGetDirectoryList(), and doTestGetFileList().

◆ prepare()

◆ provider_normalizeStoragePath()

static FileBackendTest::provider_normalizeStoragePath ( )

Definition at line 149 of file FileBackendTest.php.

◆ provider_testConcatenate()

static FileBackendTest::provider_testConcatenate ( )

Definition at line 1009 of file FileBackendTest.php.

References $content, $params, and baseStorePath().

◆ provider_testCopy()

static FileBackendTest::provider_testCopy ( )

Definition at line 360 of file FileBackendTest.php.

References $source, and baseStorePath().

◆ provider_testCreate()

static FileBackendTest::provider_testCreate ( )


Definition at line 792 of file FileBackendTest.php.

References baseStorePath().

◆ provider_testDelete()

static FileBackendTest::provider_testDelete ( )

Definition at line 586 of file FileBackendTest.php.

References $source, and baseStorePath().

◆ provider_testDescribe()

static FileBackendTest::provider_testDescribe ( )

Definition at line 701 of file FileBackendTest.php.

References $source, and baseStorePath().

◆ provider_testExtensionFromPath()

static FileBackendTest::provider_testExtensionFromPath ( )

Definition at line 201 of file FileBackendTest.php.

◆ provider_testGetContentType()

static FileBackendTest::provider_testGetContentType ( )

Definition at line 2471 of file FileBackendTest.php.

References false, FileBackendGroup\singleton(), and true.

◆ provider_testGetFileContents()

static FileBackendTest::provider_testGetFileContents ( )

Definition at line 1290 of file FileBackendTest.php.

References $base, and baseStorePath().

◆ provider_testGetFileHttpUrl()

static FileBackendTest::provider_testGetFileHttpUrl ( )

Definition at line 1534 of file FileBackendTest.php.

References $base, and baseStorePath().

◆ provider_testGetFileStat()

static FileBackendTest::provider_testGetFileStat ( )

Definition at line 1122 of file FileBackendTest.php.

References $base, baseStorePath(), false, and true.

◆ provider_testGetLocalCopy()

static FileBackendTest::provider_testGetLocalCopy ( )

Definition at line 1375 of file FileBackendTest.php.

References $base, and baseStorePath().

◆ provider_testGetLocalReference()

static FileBackendTest::provider_testGetLocalReference ( )

Definition at line 1454 of file FileBackendTest.php.

References $base, and baseStorePath().

◆ provider_testIsStoragePath()

static FileBackendTest::provider_testIsStoragePath ( )

Definition at line 99 of file FileBackendTest.php.

References false, and true.

◆ provider_testMove()

static FileBackendTest::provider_testMove ( )

Definition at line 482 of file FileBackendTest.php.

References $source, and baseStorePath().

◆ provider_testParentStoragePath()

static FileBackendTest::provider_testParentStoragePath ( )

Definition at line 179 of file FileBackendTest.php.

◆ provider_testPrepareAndClean()

static FileBackendTest::provider_testPrepareAndClean ( )

Definition at line 1560 of file FileBackendTest.php.

References $base, baseStorePath(), and true.

◆ provider_testSplitStoragePath()

static FileBackendTest::provider_testSplitStoragePath ( )

Definition at line 124 of file FileBackendTest.php.

◆ provider_testStore()

static FileBackendTest::provider_testStore ( )

Definition at line 268 of file FileBackendTest.php.

References baseStorePath(), TempFSFile\factory(), and wfTempDir().

◆ provider_testStreamFile()

static FileBackendTest::provider_testStreamFile ( )

Definition at line 1175 of file FileBackendTest.php.

References $base, and baseStorePath().

◆ setUp()

◆ tearDownFiles()

◆ testAsyncWrites()

FileBackendTest::testAsyncWrites ( )

Definition at line 2528 of file FileBackendTest.php.

References MediaWikiTestCase\setMwGlobals(), and wfWikiID().

◆ testConcatenate()

FileBackendTest::testConcatenate (   $op,


Definition at line 934 of file FileBackendTest.php.

References $multiBackend, $singleBackend, doTestConcatenate(), and tearDownFiles().

◆ testCopy()

FileBackendTest::testCopy (   $op)

provider_testCopy FileBackend::doOperation

Definition at line 291 of file FileBackendTest.php.

References $multiBackend, $singleBackend, doTestCopy(), and tearDownFiles().

◆ testCreate()

FileBackendTest::testCreate (   $op,

provider_testCreate FileBackend::doOperation

Definition at line 727 of file FileBackendTest.php.

References $multiBackend, $singleBackend, doTestCreate(), and tearDownFiles().

◆ testDelete()

FileBackendTest::testDelete (   $op,

provider_testDelete FileBackend::doOperation

Definition at line 534 of file FileBackendTest.php.

References $multiBackend, $singleBackend, doTestDelete(), and tearDownFiles().

◆ testDescribe()

FileBackendTest::testDescribe (   $op,

provider_testDescribe FileBackend::doOperation

Definition at line 626 of file FileBackendTest.php.

References $multiBackend, $singleBackend, doTestDescribe(), and tearDownFiles().

◆ testDoOperations()

FileBackendTest::testDoOperations ( )

◆ testDoOperationsFailing()

FileBackendTest::testDoOperationsFailing ( )

◆ testDoOperationsPipeline()

FileBackendTest::testDoOperationsPipeline ( )

◆ testDoQuickOperations()

FileBackendTest::testDoQuickOperations ( )

◆ testExtensionFromPath()

FileBackendTest::testExtensionFromPath (   $path,

provider_testExtensionFromPath FileBackend::extensionFromPath

Definition at line 196 of file FileBackendTest.php.

References $path, $res, and FileBackend\extensionFromPath().

◆ testGetContentType()

FileBackendTest::testGetContentType (   $mimeCallback,


Definition at line 2445 of file FileBackendTest.php.

References $IP, and global.

◆ testGetDirectoryList()

◆ testGetFileContents()

FileBackendTest::testGetFileContents (   $source,

◆ testGetFileHttpUrl()

FileBackendTest::testGetFileHttpUrl (   $source,

provider_testGetFileHttpUrl FileBackend::getFileHttpUrl

Definition at line 1504 of file FileBackendTest.php.

References $content, $multiBackend, $singleBackend, $source, doTestGetFileHttpUrl(), and tearDownFiles().

◆ testGetFileList()

FileBackendTest::testGetFileList ( )

◆ testGetFileStat()

FileBackendTest::testGetFileStat (   $path,

provider_testGetFileStat FileBackend::getFileStat

Definition at line 1061 of file FileBackendTest.php.

References $content, $multiBackend, $path, $singleBackend, doTestGetFileStat(), and tearDownFiles().

◆ testGetLocalCopy()

FileBackendTest::testGetLocalCopy (   $source,

provider_testGetLocalCopy FileBackend::getLocalCopy

Definition at line 1309 of file FileBackendTest.php.

References $content, $multiBackend, $singleBackend, $source, doTestGetLocalCopy(), and tearDownFiles().

◆ testGetLocalCopyAndReference404()

FileBackendTest::testGetLocalCopyAndReference404 ( )

◆ testGetLocalReference()

FileBackendTest::testGetLocalReference (   $source,

provider_testGetLocalReference FileBackend::getLocalReference

Definition at line 1395 of file FileBackendTest.php.

References $content, $multiBackend, $singleBackend, $source, doTestGetLocalReference(), and tearDownFiles().

◆ testIsStoragePath()

FileBackendTest::testIsStoragePath (   $path,

provider_testIsStoragePath FileBackend::isStoragePath

Definition at line 94 of file FileBackendTest.php.

References $path, and FileBackend\isStoragePath().

◆ testLockCalls()

FileBackendTest::testLockCalls ( )

◆ testMove()

FileBackendTest::testMove (   $op)

provider_testMove FileBackend::doOperation

Definition at line 412 of file FileBackendTest.php.

References $multiBackend, $singleBackend, doTestMove(), and tearDownFiles().

◆ testNormalizeStoragePath()

FileBackendTest::testNormalizeStoragePath (   $path,

provider_normalizeStoragePath FileBackend::normalizeStoragePath

Definition at line 144 of file FileBackendTest.php.

References $path, $res, and FileBackend\normalizeStoragePath().

◆ testParentStoragePath()

FileBackendTest::testParentStoragePath (   $path,

provider_testParentStoragePath FileBackend::parentStoragePath

Definition at line 174 of file FileBackendTest.php.

References $path, $res, and FileBackend\parentStoragePath().

◆ testPrepareAndClean()

FileBackendTest::testPrepareAndClean (   $path,

◆ testReadAffinity()

FileBackendTest::testReadAffinity ( )

Definition at line 2478 of file FileBackendTest.php.

References wfWikiID().

◆ testRecursiveClean()

FileBackendTest::testRecursiveClean ( )

◆ testSanitizeOpHeaders()

FileBackendTest::testSanitizeOpHeaders ( )

◆ testSplitStoragePath()

FileBackendTest::testSplitStoragePath (   $path,

provider_testSplitStoragePath FileBackend::splitStoragePath

Definition at line 119 of file FileBackendTest.php.

References $path, $res, and FileBackend\splitStoragePath().

◆ testStore()

FileBackendTest::testStore (   $op)


Definition at line 213 of file FileBackendTest.php.

References $multiBackend, $singleBackend, MediaWikiTestCase\addTmpFiles(), doTestStore(), and tearDownFiles().

◆ testStreamFile()

FileBackendTest::testStreamFile (   $path,

provider_testGetFileStat FileBackend::streamFile

Definition at line 1137 of file FileBackendTest.php.

References $content, $multiBackend, $path, $singleBackend, doTestStreamFile(), and tearDownFiles().

◆ testStreamFileRange()

FileBackendTest::testStreamFileRange ( )

Member Data Documentation

◆ $backend

FileBackend FileBackendTest::$backend

Definition at line 11 of file FileBackendTest.php.

◆ $backendToUse


Definition at line 16 of file FileBackendTest.php.

Referenced by setUp().

◆ $multiBackend

◆ $singleBackend

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