aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/GlobalFunctions
Commit message (Collapse)AuthorAgeFilesLines
...
* Add and use wikimedia/base-convert 1.0.1Kunal Mehta2015-10-301-195/+0
| | | | Change-Id: I3ae56e761ef6fb2b2d506bc2990b97f57183ccf1
* resourceloader: Consistently refer to the framework as ResourceLoaderTimo Tijhof2015-10-281-3/+0
| | | | Change-Id: Ia59e4eac9662723e80d62f7cfcb9e4292e3ee4de
* Rename getMainClusterInstance() -> getLocalClusterInstance()Aaron Schulz2015-10-201-3/+3
| | | | | | Also corrected some ObjectCache docs Change-Id: I322f4cbd72fbd5d4c6887d90ee75d0baddb6ac25
* Merge "Add `makeKey` and `makeGlobalKey` to BagOStuff"jenkins-bot2015-10-171-64/+10
|\
| * Add `makeKey` and `makeGlobalKey` to BagOStuffOri Livneh2015-10-131-64/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add a string `keyspace` member to BagOStuff instances. The default implementation, meant for simple key/value stores, treats the key space as a string prefix to prepend to keys. By default, its value is `local`, but any instance created via ObjectCache::newFromParams() (or or one of its callers) will have that default to $wgCachePrefix / wfWikiID(). * Add `makeKey` and `makeGlobalKey` methods to the base BagOStuff class. These methods are not static to allow for BagOStuff types which require a configured instance to know the underlying storage engine's key semantics. * Make wfMemcKey() and wfGlobalCacheKey() delegate to these methods on the main ObjectCache instance. Change-Id: Ib7fc2f939be3decfa97f66af8c2431c51039905f
* | Merge "Remove empty comment line from GlobalTest.php"jenkins-bot2015-10-141-1/+0
|\ \
| * | Remove empty comment line from GlobalTest.phpumherirrender2015-10-141-1/+0
| |/ | | | | | | | | | | | | Remove empty line comments as found by the MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.EmptyComment sniff Change-Id: Ibd60165ae8ddef2a2fd443856e7476f32a0c6392
* / Use the frame 'type' in wfFormatStackFrame, like ↵Alex Monk2015-10-141-5/+5
|/ | | | | | | | MWExceptionHandler::prettyPrintTrace Instead of assuming '::' Change-Id: I2452bc5ebd3716eb61f53da41a0050f4833fb5a4
* Fix class name of WfEscapeShellArgTestumherirrender2015-10-071-1/+1
| | | | | | All other global function test also begin with a upper case letter Change-Id: Icbaa701983a6f9b57e1ecaa705ebeacaada90cd6
* Fix issues identified by SpaceBeforeSingleLineComment sniffVivek Ghaisas2015-09-262-7/+7
| | | | Change-Id: I048ccb1fa260e4b7152ca5f09b053defdd72d8f9
* Some bugzilla.wikimedia.org -> phabricator.wikimedia.org changesumherirrender2015-09-241-8/+8
| | | | | | | | Changed some old bugzilla links to new phabricator links in comments, test data and error message. This reduces the need for redirects from old bugzilla to new phabricator from our source code. Change-Id: Id98278e26ce31656295a23f3cadb536859c4caa5
* Revert "Do not encode "'" as %27 (redirect loop in Opera 12)"Bartosz Dziewoński2015-09-101-2/+5
| | | | | | | | This seems to cause redirect loops in current Firefox instead. This reverts commit a89a21990e9d696487c4da72f88f765e2b4b1c34. Bug: T106793 Change-Id: I18fac8ab0f94e2df8476131b132c9866902a02c4
* Do not encode "'" as %27 (redirect loop in Opera 12)Bartosz Dziewoński2015-09-051-5/+2
| | | | | | | | | Similar to 7b4df0e12e36332fc2b303d7dac2295f8d36c888, but for apostrophe instead of tilde and for Opera instead of Chrome. Bug: T106793 Change-Id: Ic54390434cebcc76a6c8ab49acc164d36e0cdff6
* Implement wfArrayPlus2d which combines 2d arraysFlorian2015-09-011-0/+94
| | | | | | | | | Moved the logic of ExtensionRegistrations array_plus_2d merge method out to it's own global function wfArrayPlus2d, so any other function in mediawiki core and it's extensions can use this method when they need to union a 2d array. Change-Id: I56afdf306e399a4a1505828ed76c60c1bfd033b6
* Made MWTimestamp handle UNIX floatsAaron Schulz2015-08-201-0/+1
| | | | | | | | * This avoids "wfTimestamp() fed bogus time value" errors that show up in the debug log on page views, do to User::getTouched() usage. Change-Id: I899d6edd2b59c02e618ed14f8d29dea53d866f05
* Do not encode '~' as %7E. Fixes redirect loop in chrome.Brian Wolff2015-07-091-0/+2
| | | | | | | | | | | | | | As of 155d555b83eca640, we now redirect variations on hex escapes into their canonical form. This was causing '~' to be redirected to %7E. However google chrome seems to canonicalize %7E back into ~, causing a redirect loop. RFC 3986 says ~ is unreserved, so not hex encoding it should be fine. To quote: "For consistency, percent-encoded octets in the ranges of...tilde (%7E) should not be created by URI producers" Bug: T105265 Change-Id: I01556eee496e2fb540de8ff09c082c1fedddb5f7
* Implement wfGlobalCacheKey() for database-agnostic keysTimo Tijhof2015-06-231-0/+99
| | | | | | | | | | | | | | | Some code paths abuse wfForeignMemcKey() for this purpose. This is semantically incorrect and seems fragile. Also the empty second argument (for db-prefix) is either misused or akwardly set to the empty string. It also creates a namespace conflict between arbitrary application keys (from the software) and any database names (from users). This commit reduces the conflict surface down to a single key (namely, "global"). Also added unit tests to assert the implicit restrictions and assumptions between these cache key functions are valid. Change-Id: Ia0953b51005fe3de3b881dd1bd64c9d3c85e8c66
* Use mediawiki/at-ease library for suppressing warningsKunal Mehta2015-06-111-2/+2
| | | | | | | | | | | | | | | wfSuppressWarnings() and wfRestoreWarnings() were split out into a separate library. All usages in core were replaced with the new functions, and the wf* global functions are marked as deprecated. Additionally, some uses of @ were replaced due to composer's autoloader being loaded even earlier. Ie1234f8c12693408de9b94bf6f84480a90bd4f8e adds the library to mediawiki/vendor. Bug: T100923 Change-Id: I5c35079a0a656180852be0ae6b1262d40f6534c4
* Remove unused "swap" global functionKunal Mehta2015-04-101-18/+0
| | | | | | Deprecated in 26e1e083e8bfd4, unused since r12411. Change-Id: If328f09114ac5a5d23a300d9b0bbcd7d67e051c8
* Remove duplicate param escaping codeYuri Astrakhan2015-03-051-0/+43
| | | | | | | | | | | | | wfEscapeShellArg() can handle multiple params, escaping each. This patch changes wfShellExec() to call wfEscapeShellArg() directly instead of doing the gluing itself. This patch also extends wfEscapeShellArg() to accept an array parameter optionally instead of as separate args, which is often useful. Added also unit test cases for single, multiple args, and single array args. Change-Id: I7a0761cc2ba98c210a9eacadd12da407d933e42a
* Remove unused alias/layer of test abstraction wfShellMaintenanceCmd()Chad Horohoe2015-03-031-5/+5
| | | | Change-Id: I28d303f9b89ffad052d06eb2dbb9e6f8cfaeea24
* Use MediaWikiTestCase methods for tempdir in unit testsTimo Tijhof2015-02-111-31/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Account for HiDPI variants in thumb.php rate limitingBrion Vibber2015-02-041-2/+19
| | | | | | | If $wgResponsiveImages is on, include the 1.5x and 2x multipliers in the wfThumbIsStandard() standard image size comparisons. Change-Id: I79d866387730cdd4d7c7a976e691192b2335b7ce
* Move wfThumbIsStandard() to GlobalFunctions and add testsTimo Tijhof2015-02-041-0/+87
| | | | Change-Id: Ife9c011a476a4022cd72d433497944cbd7258e67
* Use MWLogger logging for legacy logging methodsBryan Davis2014-10-291-3/+3
| | | | | | | | | | | | Send wfDebug, wfDebugLog, wfLogDBError and wfLogDBError log messages to the new MWLogger PSR-3 logger subsystem. Compatibility with the historic logging operations of wfLogDBError are provided by MWLoggerLegacyLogger and the MWLoggerLegacySpi logger factory. Requires the MWLogger system introduced in I5c82299 and the Composer managed libraries from Ie667944. Change-Id: I1e5596d590144fbfdfd5f18bc42cf1ef0dbcac12
* Add test cases for wfAppendQuerySergio Santoro2014-09-291-0/+67
| | | | Change-Id: I51e0e1764ad70d922466d62f1ddf3f8e3fb4568f
* GlobalTest: Add test for wfRandomString()Sergio Santoro2014-09-031-2/+22
| | | | Change-Id: I8e681ed6a32a4a13603cad3cd3dc56545e16220f
* wfBaseConvert(): Work around PHP Bug #50175Kevin Israel2014-09-021-0/+6
| | | | | | | | | | | | | Before php/php-src@834daa455bc9, PHP's gmp_init() function would try to autodetect hex and binary numbers even when a base was explicitly specified[1], so the results for some base-36 numbers having leading zeros could be incorrect. Work around this bug by trimming off any leading zeros before calling gmp_init(). [1]: https://bugs.php.net/bug.php?id=50175 Bug: 69249 Change-Id: I5f5458c1a1195f55fa12904c103da6ea7558010a
* Cleanup some docs (tests)umherirrender2014-08-111-1/+1
| | | | | | | | | - Swap "$variable type" to "type $variable" - Fixed spacing inside docs - Makes beginning of @param/@var/@throws in capital - Changed some types to match the more common spelling Change-Id: Ia041964250d8b7c0349d79dc9b131c5b8696e795
* Revert "test: coverage for wfWikiID()"Chad2014-07-291-22/+0
| | | | | | | | Introduces broken test that doesn't pass regression or HHVM. This reverts commit 4f55b804f20960e039671a3dbf3f3eb4a5a4b81e. Change-Id: Ib82cc9b89e7392b752e9ef98134e90186e371247
* test: coverage for wfWikiID()Antoine Musso2014-07-291-0/+22
| | | | | | | Basic coverage test, note that $wgDBprefix is used as a suffix! Bug: 68231 Change-Id: Ic454ce38672b1f18db2a7f2f46c50bcfc5ee83d0
* Each line in a doc block should start with *umherirrender2014-07-241-1/+1
| | | | | | Added missing * to some doc blocks Change-Id: I0709f2e94b053437fa0f06bb67ae7ae4c248a618
* Standardize @todoumherirrender2014-07-231-1/+1
| | | | | | | Always use lowercase @todo Changed some "@FIXME" to "@todo FIXME: " Change-Id: I016d1f9511e6f3bbd22427f0fffeccd77ab5e0db
* Fix race condition in wfShellExec()Max Semenik2014-07-211-0/+20
| | | | | | | | | | | Especially when executing commands that return a relatively lot of data in stdout quickly, proc_get_status() may return that command has terminated before everything has been read from pipes. Handle this case by continuing to perform non-blocking select on the process's streams until all remaining data has been read. Bug: 67870 Change-Id: I050292dbb76821f66a15f937bf3aaf4defe67687
* Mark relevant tests with @group GlobalFunctionsMax Semenik2014-07-2013-1/+20
| | | | Change-Id: I4133ad7e5e042a8c24d4836ae2bf9f1880a56e70
* Fixed spacingumherirrender2014-07-191-1/+1
| | | | | | | | - Added/removed spaces around parenthesis - Added space after switch/if/foreach - changed else if to elseif Change-Id: I99cda543e0e077320091addd75c188cb6e3a42c2
* Merge "GlobalFunctions: Deprecate swap()"jenkins-bot2014-07-101-0/+2
|\
| * GlobalFunctions: Deprecate swap()Kevin Israel2014-06-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | This unprefixed function, added in r7198 (2b3f4c749d3d), has been unused since r12411 (f2a59db33f33). It is short and simple enough that on the rare occasions it is needed, it can be inlined or copied into the calling class as a private method. Alternatively, the idiom `list( $a, $b ) = array( $b, $a )` can be used. Change-Id: Ieb4602597a54eb21a5de177fee6dafa7ac71ce1d
* | test: Remove MagicVariableTest#testServernameFromDifferentProtocolsTimo Tijhof2014-06-251-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This test was causing failures locally when wgServer != localhost because {{SERVERNAME}} is derived from wgServerName, not wgServer and the test is only mocking wgServer. > MagicVariableTest::testServername.. with data set #2 ('//localhost/') > Magic servername should be <localhost:string> > Failed asserting that two strings are identical. > --- Expected > +++ Actual > @@ @@ > -localhost > +krinkle.dev This value is no longer derived by the Parser, but is instead set using wfParserUrl in Setup.php. Remove this obsolete test and add any missing test cases for wgParserUrl to its test suite. Change-Id: I7d7d201cb46841e63dac8ab9fd81b45b252264a3
* | Ignore days of random failing tests in wfTimestampTestaddshore2014-06-181-4/+11
|/ | | | | | | | This switches 2 of the testcases to use a regex instead of an exact match Bug: 64946 Change-Id: I24b64b34787eb1b6bbf6e6b6178a2bbf5eb7c32c
* Pass phpcs-strict on tests/phpunit/GlobalFunctions/Siebrand Mazeland2014-04-247-52/+201
| | | | Change-Id: I2acc99ac96d8c738668fae2ecc9a0cee1b695f00
* Removed unneeded spaces and colons in @param and friendsumherirrender2014-04-081-5/+5
| | | | | | | | Also swapped some "$var type" to "type $var" or added missing types before the $var. Changed some other types to match the more common spelling. Makes beginning of some text in captial. Change-Id: Ic36c8c7820a6c2d603f1138130670c6bf6a1ca59
* Use lower memory limitsptarjan2013-11-231-2/+2
| | | | | | | HHVM is ~5x more memory efficient than php-src and it shouldn't make us fail this test Change-Id: I35a69766c42818c222d36e1cf2a7fabe63a4ece5
* Fixed spacingumherirrender2013-11-211-1/+0
| | | | | | | | - Removed trailing spaces in comments - Removed multiple empty lines - Removed space after object operator Change-Id: I9fd3256ab490c7cd2034de3fd94e6be6e6d6d8f2
* Fix covers tag in GlobalTestaude2013-11-161-1/+1
| | | | Change-Id: Ia9e6f539e9b70e82c3fc0b352585650aa3ec5d7a
* Introduce WebRequest::getProtocol()Tim Starling2013-11-061-8/+2
| | | | | | | | | | | | | | | | | | | | | | The use of static server detection outside of its intended use case (i.e. at the start of DefaultSettings.php), for example in r93258, was an architectural error. Every other bit of information about the web request in non-setup code comes from non-static methods of WebRequest, which allows the request object to be meaningfully replaced or subclassed. The situation became increasingly ridiculous as more callers of WebRequest::detectProtocol() were introduced. Two of the callers were calling it non-statically! I suppose they had the right idea, in a way. Using a non-static call allows caching, which is a nice additional benefit. WebRequest::detectProtocolAndStdPort() was introduced in r93258 as part of the introduction of WebRequest::detectProtocol(). It was basically useless. Grep indicates there was only one caller in core and WMF deployed extensions, and it is patched here. Change-Id: Ia0a61e98fbff7a46ceaeebcb02236e5eac3df0e1
* @covers for all GlobalFunc testsaddshore2013-10-2413-91/+89
| | | | | | | Also split 2 tests off into their correct test classes, this methods are clearly no longer global functions Change-Id: I482433f3099e72507a766e85d9576ff36e58b9ad
* Fix scope on all /phpunit test methodsaddshore2013-10-247-33/+33
| | | | Change-Id: I3ce92463d485a0fb23e464e9a8059330f32d79af
* wfMkdirParents: recover from mkdir race conditionElliott Eggleston2013-09-121-0/+9
| | | | | | | | | | | If mkdir fails, check again to see if dir has been created since our initial check, and return true if so. Also, in initial check, only return true if $dir is really a directory, not a file. Bug: 49391 Change-Id: I2b331669fae70948ce79ba1477c05968a3095c3d
* Fix spacing and break some linesumherirrender2013-08-242-2/+2
| | | | Change-Id: Ia57685d8858e02e399ad5c75ce64d12609d340ac