aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/api/ApiTestCaseUpload.php
Commit message (Collapse)AuthorAgeFilesLines
* Rework ApiUploadTestPetr Pchelko2019-08-301-7/+0
| | | | | Bug: T28169 Change-Id: I923bf82d07db0efce1d0d14cf04e15bb58472f59
* Drop deprecated EnableAPI and EnableWriteAPI settingsJames D. Forrester2018-04-181-1/+0
| | | | | | | | | The siteinfo API response's 'writeapi' value is now hard-set to true, as are the ResourceLoader variables wgEnableAPI and wgEnableWriteAPI, to be deprecated later. Bug: T115414 Change-Id: I54ff9428b247ba203d67aba079149393f323d5a9
* Rename ApiTestCaseUploadUmherirrender2018-03-161-147/+2
| | | | | | | Having *TestCase at end of the class name makes it easier to detect it as TestCase class Change-Id: Ic7ae7328e729c0f2d97afcf7c5be793d6a8df58f
* Convert all array() syntax to []Kunal Mehta2016-02-171-8/+8
| | | | | | | | | | 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
* Revert "Remove SessionManager, temporarily"Brad Jorsch2016-02-031-2/+0
| | | | | | This reverts commit 823db5d63dd5200d04c63da50ba6bf16f928e70b. Change-Id: Ibb3e023e4eb6715295586dea87d0725c344a8271
* Remove SessionManager, temporarilyBrad Jorsch2016-02-011-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The plan here is to take it out of 1.27.0-wmf.12 and put it back in 1.27.0-wmf.13. Since BotPasswords depends on SessionManager, that's getting temporarily removed too. This reverts the following commits: * 6acd424e0dbc322e8b9a141bd2625453c1b9b6f1 SessionManager: Notify AuthPlugin before calling hooks * 4d1ad32d8acbd443346253d2f6a95024c833295c Close a loophole in CookieSessionProvider * fcdd643a46d87b677f6cdcc3ba9440e1472d8df7 SessionManager: Don't save non-persisted sessions to backend storage * 058aec4c76129b7ee8541692a8a48f8046e15bb6 MessageCache: Don't get a ParserOptions for $wgUser before the end of Setup.php * b5c0c03bb708f8dad6e404969df8addc123984db SessionManager: Save user name to metadata even if the user doesn't exist locally * 13f2f09a193215aa7a061d10a1955e172d06fa0a SECURITY: Fix User::setToken() call on User::newSystemUser * 305bc75b27903237a9683ec1f329bcbec0ecd266 SessionManager: Don't generate user tokens when checking the tokens * 7c4bd85d2152fd9fa975ea0fb5ffb1a0b804f99b RequestContext::exportSession() should only export persisted session IDs * 296ccfd4a9a6ad3ae412db7e2408c923aaa61f64 SessionManager: Save 'persisted' flag in session metadata * 94ba53f67731b0553a6178841d9506e384f74496 Move CSRF token handling into MediaWiki\Session\Session * 46a565d6b00174e631d2022b47677e1a78e73897 Avoid false "added in both Session and $_SESSION" when value is null * c00d0b5d94c946b8883dd7062bf7160a199aa5c2 Log backtrace for "User::loadFromSession called before the end of Setup.php" * 4eeff5b559e2ae7b8fa1f45572968ba28573a421 Use $wgSecureCookie to decide whether to actually mark secure cookies as 'secure' * 7491b52f700e220814a8190781fd794b4dd88a20 Call session_cache_limiter() before starting a session * 2c34aeea72471f9a598e67bdbf34bc5f9fb3f0c5 SessionManager: Abstract forceHTTPS cookie setting * 9aa53627a53aabec0273cecf45a86e77927ef406 Ignore auth cookies with value 'deleted' * 43f904b51a746d7f71ea2ab9951c5c98d269765b SessionManager: Kill getPersistedSessionId() * 50c52563528ba3d765c3762211f98d6f3c0e39fd SessionManager: Add SessionBackend::setProviderMetadata() * f640d403154bc0a2b4f6d399582797a9e3bc6fcb SessionManager: Notify AuthPlugin when auto-creating accounts * 70b05d1ac1e859bac2185b246e9b93ec9051e4d8 Add checks of $wgEnableBotPasswords in more places * bfed32eb78b6c720b16bc7ed60153fd2fe257a9e Do not raise a PHP warning when session write fails * 722a7331ad8d98228511f8da38adc7a3c64dd617 Only check LoggedOut timestamp on the user loaded from session * 4f5057b84b36eccd16627a6b29831dfdb4483b02 SessionManager: Change behavior of getSessionById() * 66e82e614e157e39b03d813e71ddf23f53cf640b Fix typo in [[MediaWiki:Botpasswords-editexisting/en]] * f9fd9516d922d36291037baca7205a2b0ac9f15f Add "bot passwords" * d7716f1df0b692902571bf415a0984071e3e9a60 Add missing argument for wfDebugLog * a73c5b7395a07d490f7052fd3b2491ebd656b190 Add SessionManager Change-Id: I2389a8133e25ab929e9f27f41fa9a05df8147a50
* Add SessionManagerBrad Jorsch2016-01-121-2/+0
| | | | | | | | | | | | | | | SessionManager is a general-purpose session management framework, rather than the cookie-based sessions that PHP wants to provide us. While fallback is provided for using $_SESSION and other PHP session management functions, they should be avoided in favor of using SessionManager directly. For proof-of-concept extensions, see OAuth change Ib40b221 and CentralAuth change I27ccabdb. Bug: T111296 Change-Id: Ic1ffea74f3ccc8f93c8a23b795ecab6f06abca72
* tests: Clean up file headersTimo Tijhof2015-04-011-2/+1
| | | | | | | | | | * Remove redundant @licence/@license from test suite files. They already have full licence headers. And @licence raises a warning in Doxygen. * Fix weird messes of comments inside comments and other things. Change-Id: I38da8ca76330f72b8dc22b0ecf1ea69d5ea55ede
* Use MediaWikiTestCase methods for tempdir in unit testsTimo Tijhof2015-02-111-17/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Cleanup some docs (tests)umherirrender2014-08-111-6/+6
| | | | | | | | | - 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
* Unify the spelling of MIME in documentationrillke2014-08-071-1/+1
| | | | | | Writing MIME as written in Wikipedia and some documentation clean up. Change-Id: I9dfc36d2bf55d72d9374c4075bd6d45eef0415a4
* Pass phpcs-strict on some test files (5/x)Siebrand Mazeland2014-04-241-2/+11
| | | | Change-Id: I690645cd8a9b1165dcc8271b201c695ea9391226
* General Cleanup of some Testsaddshore2013-11-251-7/+20
| | | | | | Style Fixes, Comment fixes Change-Id: I675d3f098e81709d5dfd928af6ca54589d3d5fad
* Update code formattingSiebrand Mazeland2013-04-261-2/+2
| | | | Change-Id: I16a9b42651f1cfb1a70dffbb67b7b83dfeb90d03
* Update formattingSiebrand Mazeland2013-02-141-17/+17
| | | | | | 3 of n. Change-Id: I62ad009018c54da6cf081c334e44eb98a3c72695
* pass codesniffer on tests/Antoine Musso2013-01-281-4/+4
| | | | | | | | | | | | | | | Fix almost all occurences of the following sniffs: Generic.CodeAnalysis.UselessOverridingMethod.Found Generic.Formatting.NoSpaceAfterCast.SpaceFound Generic.Functions.FunctionCallArgumentSpacing.SpaceBeforeComma Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine Generic.PHP.LowerCaseConstant.Found PSR2.Classes.PropertyDeclaration.ScopeMissing PSR2.Files.EndFileNewline.TooMany PSR2.Methods.MethodDeclaration.StaticBeforeVisibility Change-Id: I96aacef5bafe5a2bca659744fba1380999cfc37d
* Clean and repair many phpunit tests (+ fix implied configuration)Timo Tijhof2012-10-091-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit depends on the introduction of MediaWikiTestCase::setMwGlobals in change Iccf6ea81f4. Various tests already set their globals, but forgot to restore them afterwards, or forgot to call the parent setUp, tearDown... Either way they won't have to anymore with setMwGlobals. Consistent use of function characteristics: * protected function setUp * protected function tearDown * public static function (provide..) (Matching the function signature with PHPUnit/Framework/TestCase.php) Replaces: * public function (setUp|tearDown)\( * protected function $1( * \tfunction (setUp|tearDown)\( * \tprotected function $1( * \tfunction (data|provide)\( * \tpublic static function $1\( Also renamed a few "data#", "provider#" and "provides#" functions to "provide#" for consistency. This also removes confusion where the /media tests had a few private methods called dataFile(), which were sometimes expected to be data providers. Fixes: TimestampTest often failed due to a previous test setting a different language (it tests "1 hour ago" so need to make sure it is set to English). MWNamespaceTest became a lot cleaner now that it executes with a known context. Though the now-redundant code that was removed didn't work anyway because wgContentNamespaces isn't keyed by namespace id, it had them was values... FileBackendTest: * Fixed: "PHP Fatal: Using $this when not in object context" HttpTest * Added comment about: "PHP Fatal: Call to protected MWHttpRequest::__construct()" (too much unrelated code to fix in this commit) ExternalStoreTest * Add an assertTrue as well, without it the test is useless because regardless of whether wgExternalStores is true or false it only uses it if it is an array. Change-Id: I9d2b148e57bada64afeb7d5a99bec0e58f8e1561
* Use WikiPage instead of Article to call doDeleteArticle()Alexandre Emsenhuber2012-01-271-2/+2
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/110172
* Add phpunit tests for chunk upload api.Jan Gerber2011-12-271-0/+21
| | | | | | | | Follow up r104687 Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/107361
* Merged FileBackend branch. Manually avoiding merging the many prop-only ↵Aaron Schulz2011-12-201-1/+1
| | | | | | | changes SVN likes to sprinkle in (easy to spot from the change list). Did not add SwiftFileBackend.php as it still is in development. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/106752
* clean some files when testing uploadAntoine Musso2011-12-081-0/+13
| | | | | | | | | | This catch temporary uploaded files which are six characters long. Follow-up r102458 Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/105550
* Follow up r87210Platonides2011-05-011-8/+0
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/87229
* Follow up r85566. Add the helper classes to test autoloader.Platonides2011-04-101-2/+0
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/85762
* Various fixes for PHPUnit tests:Paul Copperman2011-04-071-5/+1
| | | | | | | | | | | | | | | * Block.php: Set mExpiry to the value we store in the database, so that Block::equals() returns true. Fixes BlockTest::testInitializerFunctionsReturnCorrectBlock. * In Title::checkUserBlock(): Convert message parameters to plain strings to make strict comparisons work. Fixes TitlePermissionTest::testUserBlock(). * ApiBlock.php: Follow-Up r85166, add 'Confirm' parameter to data array. Fixes ApiBlockTest::testMakeNormalBlock(). * ApiQueryTest.php: Use $wgMetaNamespace instead of $wgSitename to account for customizations. * RandomImageGenerator.php: Use default value for constructor param to prevent fatals. * ApiTestCaseUpload.php: ** Fix undefined variable $fileName. ** Remove stray ini_set statements, they don't belong there. Especially ini_set( 'error_reporting', 1 ) will effectively disable all reporting, which makes errors hard to track. * ArticleTablesTest.php: Put testbug14404() in group Broken, as the fix for the bug has been reverted in r83868. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/85618
* Apply modification of mdale's patch from Bug #28420: “Re-factor upload ↵Mark A. Hershberger2011-04-061-0/+128
tests to support extensions extending upload test case” Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/85566