aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/filebackend
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix @covers for FileBackendTim Starling2017-02-272-56/+43
| | | | | | | | | | | | | It's up to the developer to choose the level of granularity they are aspiring for in their test coverage. But that granularity level should be reflected in @covers. When you have hundreds of lines of code testing a single-line function (FileBackend::doOperation), that's a good hint that something went wrong. FileBackendTest is 2700 lines of code and appears to be aiming to test the whole filebackend module. So I adjusted @covers to reflect that. Change-Id: Iacd8cf475d1761c3b32c739983343619a9509d6b
* Merge "FSFile and TempFSFile cleanups"jenkins-bot2016-09-201-4/+4
|\
| * FSFile and TempFSFile cleanupsAaron Schulz2016-09-191-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | * Remove wf* function dependencies. This includes wfTempDir(). Callers now should specify the directory, though it will try to do most of the wfTempDir() logic anyway if they do not. * Update callers to inject wfTempDir() so $wgTmpDirectory is used by TempFSFile instead of it probing to find a valid directory itself. * Move most of the wfTempDir() logic to TempFSFile::getUsableTempDirectory(). * Remove unused getMimeType() method. Change-Id: Idd55936b07f9448a6c90577708722b7b52b8fe66
* | Move some FileBackend related classes to /libsAaron Schulz2016-09-191-13/+13
|/ | | | Change-Id: I0c3a84c2ed8b869519f4d38475a77539c24a88a8
* Added Range support to FileBackend::streamFile()Aaron Schulz2016-06-041-9/+57
| | | | | | | | | | | | | | | | | * Added HTTP options headers parameter to streamFile(). * Refactored doStreamFile() to either call StreamFile::stream() or delagate that to the subclass. SwiftFileBackend now relays the full Swift response rather than manually making the headers. This also makes Range headers easy to support. * Made use of this in img_auth.php for performance on private wikis. * Elimate stat call in streamFile() for Swift if "headers" is empty. * Refactored StreamFile a bit to inject request headers instead of using the $_SERVER global. A header options parameter is used instead, which also supports Range. * Removed now unused prepareForStream(). * Cleaned up streamFile() unit tests. Change-Id: I2ccbcbca6caabb8cf65bd6b3084cede2e6ea628a
* Many more function case mismatchesReedy2016-03-191-2/+2
| | | | Change-Id: I5d3a5eb8adea1ecbf136415bb9fd7a162633ccca
* Fix numerous class/function casingReedy2016-03-181-1/+1
| | | | Change-Id: I23982bfa0548c9ea3bdb432be7982f1563930715
* Add missing namespace to @covers commentsTimo Tijhof2016-02-231-4/+4
| | | | | | | | | | | | | | | | | | | PHP_CodeCoverage_Exception: > Trying to @cover not existing method "SwiftFileBackend::sanitzeHdrs". > Trying to @cover not existing method "LineFormatter::normalizeException". > Trying to @cover not existing method "MonologSpi::mergeConfig". > Trying to @cover not existing method "ProcessCacheLRU::het". > Trying to @cover not existing method "BitmapHandler::swapICCProfile". > Trying to @cover not existing class or interface "checkParseSafety". > Trying to @cover not existing method "Article::__call". (was removed). > Trying to @cover not existing method "ExtensionProcessor::extracttExtensionMessagesFiles". > Trying to @cover not existing method "FileContentsHasher::getFileContentHash". Makes code coverage run fail at the moment. These used to be warnings in PHPUnit 3.x, but are now hard exceptions in PHPUnit 4.x when requesting a coverage report. Change-Id: If7f45ca57fd7d480d35b1414a889398837c0c472
* Convert all array() syntax to []Kunal Mehta2016-02-172-578/+578
| | | | | | | | | | Per wikitech-l consensus: https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html Notes: * Disabled CallTimePassByReference due to false positives (T127163) Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
* Merge "tests: Clean up use of mt_rand()"jenkins-bot2015-12-061-2/+1
|\
| * tests: Clean up use of mt_rand()Timo Tijhof2015-12-031-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | * ApiQueryTest: One random is enough. * FileBackendTest: More consistent and idiomatic via wfRandomString() * MigrateFileRepoLayoutTest: Use getNewTempDirectory(). Similar to what FileBackendTest used already. * UploadFromUrlTestSuite: Use getNewTempDirectory(). Change-Id: I772de2134be41506d8ed08367be8c18f354bfc72
* | Remove DeferredUpdates::forceDeferral() testing hackAaron Schulz2015-12-041-7/+1
|/ | | | Change-Id: I7f2ad8190e1a746b6c39190b86fa9c83c5b921fe
* Replace wfBaseConvert with Wikimedia\base_convertReedy2015-11-241-3/+3
| | | | Change-Id: Iadab3d018c3559daf79be90edb23d131729bdb68
* Merge "Improve MIME detection in FileBackend"jenkins-bot2015-11-031-0/+36
|\
| * Improve MIME detection in FileBackendAaron Schulz2015-11-021-0/+36
| | | | | | | | | | | | | | | | | | The content type detector will now inspect the file contents to better handle extensionless files. Also dependency inject the callback and make the default one use FileInfo. Change-Id: Iad59bf6c6a416b706f976a4c425763fd30e2debb
* | Normalize header case for FileBackend operationsAaron Schulz2015-10-271-0/+31
|/ | | | | | | | Normalize all headers to lower case at the start of the FileBackend operation methods. This makes it easy for subclasses to check for certain headers, e.g. content-type. Change-Id: Ia69976326d17a51bcaa61f2781aa669ae7bd9c28
* Added replication=async option to FileBackendMultiWriteAaron Schulz2015-10-011-0/+53
| | | | | | | | * This will defer writes to non-master backends till the end up the web request. This is useful for multi-DC setups. Bug: T112708 Change-Id: I118c07764dd4a4f4f2590d4548238df12860e750
* Fix issues identified by SpaceBeforeSingleLineComment sniffVivek Ghaisas2015-09-261-2/+2
| | | | Change-Id: I048ccb1fa260e4b7152ca5f09b053defdd72d8f9
* Remove excess newlines at the end of filesRicordisamoa2015-09-271-1/+0
| | | | | | Many of them added with commit 776c865077ea38ca1f9205ad778a600b41332d60 Change-Id: I481b15c45ead1f5f482e120cb40ea8f3297543cf
* Fixed spacingumherirrender2015-09-261-1/+1
| | | | | | | | | | - Removed space after cast - Removed spaces in array index - Removed double spaces - Added spaces around string concat - Fixed mixed tabs and spaces at begin of line Change-Id: I38e849723f055d2d4c05cba72f5c245a28e8d5da
* Re-enable Generic.Files.EndFileNewline.NotFoundReedy2015-09-261-1/+2
| | | | Change-Id: Ib84ce8dc973f7e3fe688435a72f7936342b6f2dd
* Added read affinity tests for FileBackendMultiWriteAaron Schulz2015-09-211-0/+50
| | | | Change-Id: I1407273175396d4d3631531ff0ca0afa3009913e
* Cleaned up and split up Swift header parsing methods a bitAaron Schulz2015-08-051-3/+60
| | | | | | * Added tests for the metadata headers portion of the code Change-Id: I8ac65e31212b4cca4592f963e0ca5ad30e1349f7
* Added sanitizeHdrs() tests for SwiftAaron Schulz2015-07-291-0/+91
| | | | Change-Id: I2e3c3225c729e5220ca16f6ef4518da49e7f721c
* Replace use of assertType with assertInternalType and assertInstanceOfaude2015-04-091-1/+1
| | | | | | | | | | | | | | | | These are available in phpunit since 3.5.0, which I think is reasonable to expect people to have at this point, especially when we actually require 3.7.0 or higher in phpunit.php: Use assertSame instead of assertArrayEquals in UIDGeneratorTest. assertSame (and assertEqual) care about sortorder of the array, and is perfectly sufficient in this case to check they array is correct. if ( $puVersion !== '@package_version@' && version_compare( $puVersion, '3.7.0', '<' ) ) { die( "PHPUnit 3.7.0 or later required; you have {$puVersion}.\n" ); } Change-Id: Ic32ab45110e4c4304ef046ae8d0e98c741255559
* Profile all external HTTP requests from MWChad Horohoe2015-03-031-1/+1
| | | | Change-Id: Ie980b080da2ef21ec7d9fc32f1accc55710de140
* Use MediaWikiTestCase methods for tempdir in unit testsTimo Tijhof2015-02-111-48/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Use MediaWikiTestCase::getNewTempFile and getNewTempDirectory instead of wfTempDir(). The upload api tests wrote a tempnam() file directly (where wfTempDir() is typically shared with other systems and concurrent runs). Use MediaWikiTestCase::getNewTempFile and getNewTempDirectory instead. This also ensures its removal by the teardown handler without needing manual unlink() calls. And it doesn't rely on the test passing. (Many unlink calls where at the bottom of tests, which wouldn't be reached in case of failure). * For the upload test, the presistent storing of 'Oberaargletscher_from_Oberaar.jpg' (downloaded from Commons) was removed. Note that this didn't work for Jenkins builds anyway as Jenkins builds set $wgTmpDirectory to a unique directory in tmpfs associated with an individual build. * For filebackend tests, moved directory creation from the dataProvider to the main test. Implemented addTmpFiles() to allow subclasses to register additional files (created by other means) to be cleaned up also. Removed unused $tmpName and $toPath parameters in data provider for FileBackendTest::testStore. And fixed weird double $op2 variable name to be called $op3. * Skipped parserTest.inc, MockFileBackend.php, and UploadFromUrlTestSuite.php as those don't use MediaWikiTestCase. Change-Id: Ic7feb06ef0c1006eb99485470a1a59419f972545
* Remove MediaWikiPHPUnitCommandaddshore2014-08-021-2/+2
| | | | | | All functionality has been moved to other places Change-Id: I6b6b0ef846bc63108c4dff9e17098432fd9d1697
* Pass phpcs-strict on some test files (7/11)Siebrand Mazeland2014-04-241-17/+78
| | | | Change-Id: Ia0ceea60e7ef43959f868378f3fcd463a3adf782
* Fixed broken filebackend test for "describe"Aaron Schulz2014-04-151-0/+1
| | | | Change-Id: I30e3cfc29a1db92e7f1b85af54db778ee639e016
* Fixed wrong usage of $tmpFile in Swift backendAaron Schulz2014-01-151-2/+2
| | | | Change-Id: I21293be38c53b4dca3030c26a201f70d8ed243f3
* Merge "filebackend: Added supported for retrieving file metadata/headers"jenkins-bot2014-01-091-3/+35
|\
| * filebackend: Added supported for retrieving file metadata/headersAaron Schulz2014-01-081-3/+35
| | | | | | | | | | | | | | * This can be useful for carrying over metadata when copying files around * Also fixed a bug in sanitizeHdrs() for Swift (broken content-disposition) Change-Id: I4534e9acac2b306086797b3677f85c05b98e39fc
* | Fixed minor unit test dir leakageAaron Schulz2014-01-081-1/+1
|/ | | | Change-Id: I78cf483dde5078d4fad4e1738d8bb8a8f634e3b1
* Removed cloudfiles dependency in SwiftFileBackendAaron Schulz2014-01-071-2/+22
| | | | | | | | | | | | | | | | | | | | | | | * Added a new curl multi wrapper under libs/. * Used the new MultiHttpClient class instead of CloudFiles * Removed CDN related config and code as it does not work. well due to mutating files and tiny purge rate limits by CDNs. * Also removed the unused and esoteric 'swiftAnonUser' parameter. * Support concurrent 'describe' operations. * Set ACLs on containers on intial PUT instead of in two steps. Previously if the second step failed, prepare() would never set the ACLs correctly since it aborts if the container exists. * Improve token deletion to only trigger on 401s rather than other random errors like 50X timeouts. * Removed duplicative getResponse* code by just using one closure called for both the concurrent and serial cases. Both cases are now funneled through doExecuteOpHandlesInternal(). * Add the MD5 to stat info, as it might be useful for speeding up the copy scripts in some cases (when both backends have md5 set). * Avoid use of trigger_error() since there is a swift log group. * A few other small code cleanups. Change-Id: I1adb3e2df6df8cf01d3ad74158de96ea9a79da2e
* Fixed undefined variable errors that made tests failAaron Schulz2013-12-181-1/+3
| | | | Change-Id: Ic004e0d8d8efe3e4b313b737479b8098aa0048bc
* Added streamFile() unit testsAaron Schulz2013-12-171-0/+51
| | | | Change-Id: I2ef5680829048ab4fcc0a9f7ff9064d016800217
* filebackend: cleaned up the FileBackend constructorAaron Schulz2013-12-031-6/+5
| | | | | | * Added some b/c code with deprecation warnings Change-Id: Ifceffbc0a37a223bcd7cd3dc60181fc85765bc46
* Revert "filebackend: cleaned up the FileBackend constructor"Aaron Schulz2013-12-031-5/+6
| | | | | | | | Actually this messes with the implicit backend made for things like Math (when unconfigured), which uses the "new" operator. This reverts commit 1f129a22cbc8546b89dd4b49b2f567c1f758a968. Change-Id: I4c72c4f7c8b82e38df5496cf2b90fc9e19c40334
* filebackend: cleaned up the FileBackend constructorAaron Schulz2013-11-231-6/+5
| | | | | | | | | * Moved some of the graph construction work to FileBackendGroup. This helps the code in not depending on the rest of MW so much. * Updated tests and FileBackendMultiwrite, which are the only things directly constructing FileBackend objects. Change-Id: I188a053c70ce088ce34613d5db40e6708e3ea9b7
* Add @covers tags for more testsaddshore2013-10-211-1/+58
| | | | Change-Id: Iff3af78e9b41c445b7f066b6c0d0f4a87d2d6c4e
* docs: Remove odd colons after @todoTimo Tijhof2013-05-151-1/+1
| | | | | | | | | | Most were this way already: https://doc.wikimedia.org/mediawiki-core/master/php/html/todo.html Ran a find/replace on the odd ones. Also made them all lower case. Change-Id: I70c6a69344ddebc603e9a1c1d87e3cc4f4f4c560
* [FileBackend] Added "adviseStat" option for the "listing followed by stat" case.Aaron Schulz2013-05-091-30/+41
| | | | | | | | * Used this parameter to speed up copyFileBackend.php. * Also added mtime checks to copyFileBackend.php and a few cleanups. * Also fixed some incorrect getDirListPageInternal/getFileListPageInternal docs. Change-Id: I424ef238f7adf4cf1f33b74e3a4e187dcb328a99
* Update code formattingSiebrand Mazeland2013-04-261-0/+4
| | | | Change-Id: I16a9b42651f1cfb1a70dffbb67b7b83dfeb90d03
* Cleaned up test cleanup for FileBackend and avoid use of @.Aaron Schulz2013-04-181-1/+4
| | | | Change-Id: Ie9f0090f626384a90b0139b9f8c2d94bf0bb8f23
* Make concurrent runs of FileBackendTest independentBrian Wolff2013-04-171-1/+4
| | | | | | | | | | | | | Make each run of the FileBackendTest be for a different "wiki" so you could have multiple runs at the same time without them interfering with each other. There's been intermittent failures on jenkins for this test. I'm not sure if its some race condition (which wouldn't really make sense given each run should be independent I thought), but this can't hurt. Change-Id: I3b639f1c783efc140028c3acdce35ef3f58bf66f
* Update code formattingSiebrand Mazeland2013-03-271-15/+20
| | | | | | | | Also update some previous inconsistencies pointed out by Krinkle in change IDs: * Ide20743a2e84ff68549286120e6cff9d9f396f54 * I811ca957b6588085d67606ebc0cd4033a1e53839 Change-Id: Ife33b931870d0d7e04fcb40974997436d27f528f
* [FileBackend] Cleanup behavior for coping/moving a file over itself.ASchulz2013-03-251-8/+42
| | | | | | | | | | | | | | | * Previously, for doQuickOperations(), the default move function would just delete the file if it was moved over itself. In fact, the php-cloudfiles bindings have this same bug in its move function. * For both copy and move, when the source and destination are the same path, make sure that the headers get updated as specified. This only applies for the 'overwrite' case (not 'overwriteSame'). * Fixed bad status for doQuickOperations() when copying a file over itself using FSFileBackend. * Clarified the documentation for 'overwriteSame' option. * Renamed destSameAsSource to overwriteSameCase in FileOp for clarity. Change-Id: I3f609d9413795c654de27958b1e807b1fc785f31
* Tests: Make phpunit providers "public static".Timo Tijhof2013-03-221-11/+11
| | | | | | | Follows-up I9d2b148e57 (including phpunit/languages this time). Bug: 46434 Change-Id: I30e5efcd88c516121c454676bd7a18f9b7c8fca6
* [FileBackend] Fixed "ignoreMissingSource" bug in multiwrite backend.Aaron Schulz2013-03-121-0/+24
| | | | | | | * Beefed up unit tests for this case and other "ignoreMissingSource" cases such as when the source container or parent directory do not exist. Change-Id: Iea6dae2424edfd0c4367e5cff606c09a4e8a865b